From 389dd41bd043170e7dc7660304f14a5f16af3562 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 16 Jul 2009 22:29:52 +0000 Subject: =?UTF-8?q?2009-07-17=20=20Aldy=20Hernandez=20=20=20=09=20=20=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 319ae69edcc..35a786aef29 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -339,7 +339,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl) tmp, fold_convert (sizetype, offset)); tmp = fold_convert (build_pointer_type (type), tmp); if (!TYPE_STRING_FLAG (type)) - tmp = build_fold_indirect_ref (tmp); + tmp = build_fold_indirect_ref_loc (input_location, tmp); return tmp; } else @@ -413,13 +413,14 @@ gfc_trans_runtime_error_vararg (bool error, locus* where, const char* msgid, va_end (ap); /* Build the function call to runtime_(warning,error)_at; because of the - variable number of arguments, we can't use build_call_expr directly. */ + variable number of arguments, we can't use build_call_expr_loc dinput_location, + irectly. */ if (error) fntype = TREE_TYPE (gfor_fndecl_runtime_error_at); else fntype = TREE_TYPE (gfor_fndecl_runtime_warning_at); - tmp = fold_builtin_call_array (TREE_TYPE (fntype), + tmp = fold_builtin_call_array (input_location, TREE_TYPE (fntype), fold_build1 (ADDR_EXPR, build_pointer_type (fntype), error @@ -482,7 +483,8 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock, cond = fold_convert (long_integer_type_node, cond); tmp = build_int_cst (long_integer_type_node, 0); - cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp); + cond = build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp); cond = fold_convert (boolean_type_node, cond); tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt (input_location)); @@ -515,7 +517,8 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Attempt to allocate a negative amount of memory.")); tmp = fold_build3 (COND_EXPR, void_type_node, negative, - build_call_expr (gfor_fndecl_runtime_error, 1, msg), + build_call_expr_loc (input_location, + gfor_fndecl_runtime_error, 1, msg), build_empty_stmt (input_location)); gfc_add_expr_to_block (block, tmp); @@ -526,14 +529,16 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) build_int_cst (size_type_node, 1)); gfc_add_modify (&block2, res, - build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, + build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_MALLOC], 1, size)); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, build_int_cst (pvoid_type_node, 0)); msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Memory allocation failed")); tmp = fold_build3 (COND_EXPR, void_type_node, null_result, - build_call_expr (gfor_fndecl_os_error, 1, msg), + build_call_expr_loc (input_location, + gfor_fndecl_os_error, 1, msg), build_empty_stmt (input_location)); gfc_add_expr_to_block (&block2, tmp); malloc_result = gfc_finish_block (&block2); @@ -615,7 +620,8 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Attempt to allocate negative amount of memory. " "Possible integer overflow")); - error = build_call_expr (gfor_fndecl_runtime_error, 1, msg); + error = build_call_expr_loc (input_location, + gfor_fndecl_runtime_error, 1, msg); if (status != NULL_TREE && !integer_zerop (status)) { @@ -624,7 +630,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) gfc_start_block (&set_status_block); gfc_add_modify (&set_status_block, - fold_build1 (INDIRECT_REF, status_type, status), + fold_build1 (INDIRECT_REF, status_type, status), build_int_cst (status_type, LIBERROR_ALLOCATION)); gfc_add_modify (&set_status_block, res, build_int_cst (pvoid_type_node, 0)); @@ -638,14 +644,16 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) /* The allocation itself. */ gfc_start_block (&alloc_block); gfc_add_modify (&alloc_block, res, - build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, + build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_MALLOC], 1, fold_build2 (MAX_EXPR, size_type_node, size, build_int_cst (size_type_node, 1)))); msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Out of memory")); - tmp = build_call_expr (gfor_fndecl_os_error, 1, msg); + tmp = build_call_expr_loc (input_location, + gfor_fndecl_os_error, 1, msg); if (status != NULL_TREE && !integer_zerop (status)) { @@ -750,7 +758,8 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, stmtblock_t set_status_block; gfc_start_block (&set_status_block); - tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, + tmp = build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_FREE], 1, fold_convert (pvoid_type_node, mem)); gfc_add_expr_to_block (&set_status_block, tmp); @@ -788,7 +797,8 @@ gfc_call_free (tree var) var = gfc_evaluate_now (var, &block); cond = fold_build2 (NE_EXPR, boolean_type_node, var, build_int_cst (pvoid_type_node, 0)); - call = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, var); + call = build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_FREE], 1, var); tmp = fold_build3 (COND_EXPR, void_type_node, cond, call, build_empty_stmt (input_location)); gfc_add_expr_to_block (&block, tmp); @@ -873,7 +883,8 @@ gfc_deallocate_with_status (tree pointer, tree status, bool can_fail, /* When POINTER is not NULL, we free it. */ gfc_start_block (&non_null); - tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1, + tmp = build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_FREE], 1, fold_convert (pvoid_type_node, pointer)); gfc_add_expr_to_block (&non_null, tmp); @@ -935,12 +946,14 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size) msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Attempt to allocate a negative amount of memory.")); tmp = fold_build3 (COND_EXPR, void_type_node, negative, - build_call_expr (gfor_fndecl_runtime_error, 1, msg), + build_call_expr_loc (input_location, + gfor_fndecl_runtime_error, 1, msg), build_empty_stmt (input_location)); gfc_add_expr_to_block (block, tmp); /* Call realloc and check the result. */ - tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2, + tmp = build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_REALLOC], 2, fold_convert (pvoid_type_node, mem), size); gfc_add_modify (block, res, fold_convert (type, tmp)); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, @@ -952,7 +965,8 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size) msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Out of memory")); tmp = fold_build3 (COND_EXPR, void_type_node, null_result, - build_call_expr (gfor_fndecl_os_error, 1, msg), + build_call_expr_loc (input_location, + gfor_fndecl_os_error, 1, msg), build_empty_stmt (input_location)); gfc_add_expr_to_block (block, tmp); -- cgit v1.2.1 From e1b3b79beacf0e6747eb7e6a1055d3cd0a436327 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 19 Aug 2009 10:17:33 +0000 Subject: * tree-ssa-structalias.c (create_variable_info_for): Also mark first field in a struct. (intra_create_variable_infos): Don't deal with flag_argument_noalias. fortran/ * trans-expr.c (gfc_conv_substring): Don't evaluate casted decl early, change order of length calculation to (end - start) + 1. (gfc_get_interface_mapping_array): Adjust call to gfc_get_nodesc_array_type. * trans-array.c (gfc_trans_create_temp_array, gfc_build_constant_array_constructor, gfc_conv_expr_descriptor): Ditto. * trans-stmt.c (gfc_trans_pointer_assign_need_temp): Ditto. * trans.c (gfc_add_modify): Assignment between base type and nontarget type are equal enough. (gfc_call_malloc): Use prvoid_type_node for return value of __builtin_malloc. (gfc_allocate_with_status): Ditto. * trans-types.c (gfc_array_descriptor_base): Double size of this array. (gfc_init_types): Build prvoid_type_node. (gfc_build_array_type): New bool parameter "restricted". (gfc_get_nodesc_array_type): Ditto, build restrict qualified pointers, if it's true. (gfc_get_array_descriptor_base): Ditto. (gfc_get_array_type_bounds): Ditto. (gfc_sym_type): Use symbol attributes to feed calls to above functions. (gfc_get_derived_type): Ditto. * trans.h (struct lang_type): Add nontarget_type member. * trans-types.h (prvoid_type_node): Declare. (gfc_get_array_type_bounds, gfc_get_nodesc_array_type): Declare new parameter. * trans-decl.c (gfc_finish_var_decl): Give scalars that can't be aliased a type with a different alias set than the base type. (gfc_build_dummy_array_decl): Adjust call to gfc_get_nodesc_array_type. testsuite/ * gfortran.dg/vect/vect-gems.f90: New test. * gcc.dg/tree-ssa/alias-1.c: Remove, it checks something broken. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150934 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 35a786aef29..f4a215aeeaf 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -159,11 +159,21 @@ gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs) tree tmp; #ifdef ENABLE_CHECKING + tree t1, t2; + t1 = TREE_TYPE (rhs); + t2 = TREE_TYPE (lhs); + /* ??? This is actually backwards, we should test the "base" type + from which the nontarget_type was copied, but we don't have this + backlink. This will do for now, it's for checking anyway. */ + if (TYPE_LANG_SPECIFIC (t1)) + t1 = TYPE_LANG_SPECIFIC (t1)->nontarget_type; + if (TYPE_LANG_SPECIFIC (t2)) + t2 = TYPE_LANG_SPECIFIC (t2)->nontarget_type; /* Make sure that the types of the rhs and the lhs are the same for scalar assignments. We should probably have something similar for aggregates, but right now removing that check just breaks everything. */ - gcc_assert (TREE_TYPE (rhs) == TREE_TYPE (lhs) + gcc_assert (t1 == t2 || AGGREGATE_TYPE_P (TREE_TYPE (lhs))); #endif @@ -509,7 +519,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) size = fold_convert (size_type_node, size); /* Create a variable to hold the result. */ - res = gfc_create_var (pvoid_type_node, NULL); + res = gfc_create_var (prvoid_type_node, NULL); /* size < 0 ? */ negative = fold_build2 (LT_EXPR, boolean_type_node, size, @@ -529,9 +539,9 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) build_int_cst (size_type_node, 1)); gfc_add_modify (&block2, res, - build_call_expr_loc (input_location, - built_in_decls[BUILT_IN_MALLOC], 1, - size)); + fold_convert (prvoid_type_node, + build_call_expr_loc (input_location, + built_in_decls[BUILT_IN_MALLOC], 1, size))); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, build_int_cst (pvoid_type_node, 0)); msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const @@ -601,7 +611,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) size = fold_convert (size_type_node, size); /* Create a variable to hold the result. */ - res = gfc_create_var (pvoid_type_node, NULL); + res = gfc_create_var (prvoid_type_node, NULL); /* Set the optional status variable to zero. */ if (status != NULL_TREE && !integer_zerop (status)) @@ -633,7 +643,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) fold_build1 (INDIRECT_REF, status_type, status), build_int_cst (status_type, LIBERROR_ALLOCATION)); gfc_add_modify (&set_status_block, res, - build_int_cst (pvoid_type_node, 0)); + build_int_cst (prvoid_type_node, 0)); tmp = fold_build2 (EQ_EXPR, boolean_type_node, status, build_int_cst (TREE_TYPE (status), 0)); @@ -644,11 +654,12 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) /* The allocation itself. */ gfc_start_block (&alloc_block); gfc_add_modify (&alloc_block, res, - build_call_expr_loc (input_location, + fold_convert (prvoid_type_node, + build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MALLOC], 1, fold_build2 (MAX_EXPR, size_type_node, size, - build_int_cst (size_type_node, 1)))); + build_int_cst (size_type_node, 1))))); msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const ("Out of memory")); @@ -671,7 +682,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) tmp = fold_build3 (COND_EXPR, void_type_node, fold_build2 (EQ_EXPR, boolean_type_node, res, - build_int_cst (pvoid_type_node, 0)), + build_int_cst (prvoid_type_node, 0)), tmp, build_empty_stmt (input_location)); gfc_add_expr_to_block (&alloc_block, tmp); @@ -723,7 +734,7 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, size = fold_convert (size_type_node, size); /* Create a variable to hold the result. */ - res = gfc_create_var (pvoid_type_node, NULL); + res = gfc_create_var (type, NULL); null_mem = fold_build2 (EQ_EXPR, boolean_type_node, mem, build_int_cst (type, 0)); -- cgit v1.2.1 From 8bb76364adb500f539b7bbd329b83e4602bf839b Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 16 Sep 2009 16:12:18 +0000 Subject: PR fortran/41212 * tree.h (struct tree_decl_common): Add decl_restricted_flag, shorten decl_common_unused. (DECL_RESTRICTED_P): New accessor. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Use it to disambiguate marked decls and restrict pointers. fortran/ * trans.h (struct lang_type): Remove nontarget_type member. * trans.c (gfc_add_modify): Don't access it. * trans-decl.c (gfc_finish_var_decl): Don't allocate and set it, instead set DECL_RESTRICTED_P on affected decls. testsuite/ * gfortran.dg/pr41212.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151761 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index f4a215aeeaf..136987a7488 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -162,13 +162,6 @@ gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs) tree t1, t2; t1 = TREE_TYPE (rhs); t2 = TREE_TYPE (lhs); - /* ??? This is actually backwards, we should test the "base" type - from which the nontarget_type was copied, but we don't have this - backlink. This will do for now, it's for checking anyway. */ - if (TYPE_LANG_SPECIFIC (t1)) - t1 = TYPE_LANG_SPECIFIC (t1)->nontarget_type; - if (TYPE_LANG_SPECIFIC (t2)) - t2 = TYPE_LANG_SPECIFIC (t2)->nontarget_type; /* Make sure that the types of the rhs and the lhs are the same for scalar assignments. We should probably have something similar for aggregates, but right now removing that check just -- cgit v1.2.1 From 6a7084d700f33c25ffdfe5e213b60f05785ba87c Mon Sep 17 00:00:00 2001 From: domob Date: Tue, 29 Sep 2009 07:42:42 +0000 Subject: 2009-09-29 Daniel Kraft PR fortran/39626 * gfortran.h (enum gfc_statement): Add ST_BLOCK and ST_END_BLOCK. (struct gfc_namespace): Convert flags to bit-fields and add flag `construct_entities' for use with BLOCK constructs. (enum gfc_exec_code): Add EXEC_BLOCK. (struct gfc_code): Add namespace field to union for EXEC_BLOCK. * match.h (gfc_match_block): New prototype. * parse.h (enum gfc_compile_state): Add COMP_BLOCK. * trans.h (gfc_process_block_locals): New prototype. (gfc_trans_deferred_vars): Made public, new prototype. * trans-stmt.h (gfc_trans_block_construct): New prototype. * decl.c (gfc_match_end): Handle END BLOCK correctly. (gfc_match_intent): Error if inside of BLOCK. (gfc_match_optional), (gfc_match_value): Ditto. * match.c (gfc_match_block): New routine. * parse.c (decode_statement): Handle BLOCK statement. (case_exec_markers): Add ST_BLOCK. (case_end): Add ST_END_BLOCK. (gfc_ascii_statement): Handle ST_BLOCK and ST_END_BLOCK. (parse_spec): Check for statements not allowed inside of BLOCK. (parse_block_construct): New routine. (parse_executable): Parse BLOCKs. (parse_progunit): Disallow CONTAINS in BLOCK constructs. * resolve.c (is_illegal_recursion): Find real container procedure and don't get confused by BLOCK constructs. (resolve_block_construct): New routine. (gfc_resolve_blocks), (resolve_code): Handle EXEC_BLOCK. * st.c (gfc_free_statement): Handle EXEC_BLOCK statements. * trans-decl.c (saved_local_decls): New static variable. (add_decl_as_local): New routine. (gfc_finish_var_decl): Add variable as local if inside BLOCK. (gfc_trans_deferred_vars): Make public. (gfc_process_block_locals): New routine. * trans-stmt.c (gfc_trans_block_construct): New routine. * trans.c (gfc_trans_code): Handle EXEC_BLOCK statements. 2009-09-29 Daniel Kraft PR fortran/39626 * gfortran.dg/block_1.f08: New test. * gfortran.dg/block_2.f08: New test. * gfortran.dg/block_3.f90: New test. * gfortran.dg/block_4.f08: New test. * gfortran.dg/block_5.f08: New test. * gfortran.dg/block_6.f08: New test. * gfortran.dg/block_7.f08: New test. * gfortran.dg/block_8.f08: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152266 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 136987a7488..f53f75e3674 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1157,6 +1157,10 @@ gfc_trans_code (gfc_code * code) res = gfc_trans_arithmetic_if (code); break; + case EXEC_BLOCK: + res = gfc_trans_block_construct (code); + break; + case EXEC_DO: res = gfc_trans_do (code); break; -- cgit v1.2.1 From 1de1b1a9e40b5aa064d5e3d032dd43ce14f6d2ad Mon Sep 17 00:00:00 2001 From: burnus Date: Wed, 30 Sep 2009 19:55:45 +0000 Subject: fortran/ 2009-09-30 Janus Weil * check.c (gfc_check_same_type_as): New function for checking SAME_TYPE_AS and EXTENDS_TYPE_OF. * decl.c (encapsulate_class_symbol): Set ABSTRACT attribute for class container, if the contained type has it. Add an initializer for the class container. (add_init_expr_to_sym): Handle BT_CLASS. (vindex_counter): New counter for setting vindices. (gfc_match_derived_decl): Set vindex for all derived types, not only those which are being extended. * expr.c (gfc_check_assign_symbol): Handle NULL initialization of class pointers. * gfortran.h (gfc_isym_id): New values GFC_ISYM_SAME_TYPE_AS and GFC_ISYM_EXTENDS_TYPE_OF. (gfc_type_is_extensible): New prototype. * intrinsic.h (gfc_check_same_type_as): New prototype. * intrinsic.c (add_functions): Add SAME_TYPE_AS and EXTENDS_TYPE_OF. * primary.c (gfc_expr_attr): Handle CLASS-valued functions. * resolve.c (resolve_structure_cons): Handle BT_CLASS. (type_is_extensible): Make non-static and rename to 'gfc_type_is_extensible. (resolve_select_type): Renamed type_is_extensible. (resolve_class_assign): Handle NULL pointers. (resolve_fl_variable_derived): Renamed type_is_extensible. (resolve_fl_derived): Ditto. * trans-expr.c (gfc_trans_subcomponent_assign): Handle NULL initialization of class pointer components. (gfc_conv_structure): Handle BT_CLASS. * trans-intrinsic.c (gfc_conv_same_type_as,gfc_conv_extends_type_of): New functions. (gfc_conv_intrinsic_function): Handle SAME_TYPE_AS and EXTENDS_TYPE_OF. 2009-09-30 Janus Weil * gfortran.h (type_selector, select_type_tmp): New global variables. * match.c (type_selector, select_type_tmp): New global variables, used for SELECT TYPE statements. (gfc_match_select_type): Better error handling. Remember selector. (gfc_match_type_is): Create temporary variable. * module.c (ab_attribute): New value 'AB_IS_CLASS'. (attr_bits): New string. (mio_symbol_attribute): Handle 'is_class'. * resolve.c (resolve_select_type): Insert pointer assignment statement, to assign temporary to selector. * symbol.c (gfc_get_ha_sym_tree): Replace selector by a temporary in SELECT TYPE statements. 2009-09-30 Janus Weil * dump-parse-tree.c (show_code_node): Renamed 'alloc_list'. * gfortran.h (gfc_code): Rename 'alloc_list'. Add member 'ts'. (gfc_expr_to_initialize): New prototype. * match.c (alloc_opt_list): Correctly check type compatibility. Renamed 'alloc_list'. (dealloc_opt_list): Renamed 'alloc_list'. * resolve.c (expr_to_initialize): Rename to 'gfc_expr_to_initialize' and make it non-static. (resolve_allocate_expr): Set vindex for CLASS variables correctly. Move initialization code to gfc_trans_allocate. Renamed 'alloc_list'. (resolve_allocate_deallocate): Renamed 'alloc_list'. (check_class_pointer_assign): Rename to 'resolve_class_assign'. Change argument type. Adjust to work with ordinary assignments. (resolve_code): Call 'resolve_class_assign' for ordinary assignments. Renamed 'check_class_pointer_assign'. * st.c (gfc_free_statement): Renamed 'alloc_list'. * trans-stmt.c (gfc_trans_allocate): Renamed 'alloc_list'. Handle size determination and initialization of CLASS variables. Bugfix for ALLOCATE statements with default initialization and SOURCE block. (gfc_trans_deallocate): Renamed 'alloc_list'. 2009-09-30 Paul Thomas * trans-expr.c (gfc_conv_procedure_call): Convert a derived type actual to a class object if the formal argument is a class. 2009-09-30 Janus Weil PR fortran/40996 * decl.c (build_struct): Handle allocatable scalar components. * expr.c (gfc_add_component_ref): Correctly set typespec of expression, after inserting component reference. * match.c (gfc_match_type_is,gfc_match_class_is): Make sure that no variables are being used uninitialized. * primary.c (gfc_match_varspec): Handle CLASS array components. * resolve.c (resolve_select_type): Transform EXEC_SELECT_TYPE to EXEC_SELECT. * trans-array.c (structure_alloc_comps,gfc_trans_deferred_array): Handle allocatable scalar components. * trans-expr.c (gfc_conv_component_ref): Ditto. * trans-types.c (gfc_get_derived_type): Ditto. 2009-09-30 Janus Weil * decl.c (encapsulate_class_symbol): Modify names of class container components by prefixing with '$'. (gfc_match_end): Handle COMP_SELECT_TYPE. * expr.c (gfc_add_component_ref): Modify names of class container components by prefixing with '$'. * gfortran.h (gfc_statement): Add ST_SELECT_TYPE, ST_TYPE_IS and ST_CLASS_IS. (gfc_case): New field 'ts'. (gfc_exec_op): Add EXEC_SELECT_TYPE. (gfc_type_is_extension_of): New prototype. * match.h (gfc_match_select_type,gfc_match_type_is,gfc_match_class_is): New prototypes. * match.c (match_derived_type_spec): New function. (match_type_spec): Use 'match_derived_type_spec'. (match_case_eos): Modify error message. (gfc_match_select_type): New function. (gfc_match_case): Modify error message. (gfc_match_type_is): New function. (gfc_match_class_is): Ditto. * parse.h (gfc_compile_state): Add COMP_SELECT_TYPE. * parse.c (decode_statement): Handle SELECT TYPE, TYPE IS and CLASS IS statements. (next_statement): Handle ST_SELECT_TYPE. (gfc_ascii_statement): Handle ST_SELECT_TYPE, ST_TYPE_IS, ST_CLASS_IS. (parse_select_type_block): New function. (parse_executable): Handle ST_SELECT_TYPE. * resolve.c (resolve_deallocate_expr): Handle BT_CLASS. Modify names of class container components by prefixing with '$'. (resolve_allocate_expr): Ditto. (resolve_select_type): New function. (gfc_resolve_blocks): Handle EXEC_SELECT_TYPE. (check_class_pointer_assign): Modify names of class container components by prefixing with '$'. (resolve_code): Ditto. * st.c (gfc_free_statement): Ditto. * symbol.c (gfc_type_is_extension_of): New function. (gfc_type_compatible): Use 'gfc_type_is_extension_of', plus a bugfix. * trans.c (gfc_trans_code): Handel EXEC_SELECT_TYPE. 2009-09-30 Janus Weil Paul Thomas * check.c (gfc_check_move_alloc): Arguments don't have to be arrays. The second argument needs to be type-compatible with the first (not the other way around, which makes a difference for CLASS entities). * decl.c (encapsulate_class_symbol): New function. (build_sym,build_struct): Handle BT_CLASS, call 'encapsulate_class_symbol'. (gfc_match_decl_type_spec): Remove warning, use BT_CLASS. (gfc_match_derived_decl): Set vindex; * expr.c (gfc_add_component_ref): New function. (gfc_copy_expr,gfc_check_pointer_assign,gfc_check_assign_symbol): Handle BT_CLASS. * dump-parse-tree.c (show_symbol): Print vindex. * gfortran.h (bt): New basic type BT_CLASS. (symbol_attribute): New field 'is_class'. (gfc_typespec): Remove field 'is_class'. (gfc_symbol): New field 'vindex'. (gfc_get_ultimate_derived_super_type): New prototype. (gfc_add_component_ref): Ditto. * interface.c (gfc_compare_derived_types): Pointer equality check moved here from gfc_compare_types. (gfc_compare_types): Handle BT_CLASS and use gfc_type_compatible. * match.c (gfc_match_allocate,gfc_match_deallocate,gfc_match_call): Handle BT_CLASS. * misc.c (gfc_clear_ts): Removed is_class. (gfc_basic_typename,gfc_typename): Handle BT_CLASS. * module.c (bt_types,mio_typespec): Handle BT_CLASS. (mio_symbol): Handle vindex. * primary.c (gfc_match_varspec,gfc_variable_attr): Handle BT_CLASS. * resolve.c (find_array_spec,check_typebound_baseobject): Handle BT_CLASS. (resolve_ppc_call,resolve_expr_ppc): Don't call 'gfc_is_proc_ptr_comp' inside 'gcc_assert'. (resolve_deallocate_expr,resolve_allocate_expr): Handle BT_CLASS. (check_class_pointer_assign): New function. (resolve_code): Handle BT_CLASS, call check_class_pointer_assign. (resolve_fl_var_and_proc,type_is_extensible,resolve_fl_variable_derived, resolve_fl_variable): Handle BT_CLASS. (check_generic_tbp_ambiguity): Add special case. (resolve_typebound_procedure,resolve_fl_derived): Handle BT_CLASS. * symbol.c (gfc_get_ultimate_derived_super_type): New function. (gfc_type_compatible): Handle BT_CLASS. * trans-expr.c (conv_parent_component_references): Handle CLASS containers. (gfc_conv_initializer): Handle BT_CLASS. * trans-types.c (gfc_typenode_for_spec,gfc_get_derived_type): Handle BT_CLASS. testsuite/ 2009-09-30 Janus Weil * gfortran.dg/same_type_as_1.f03: New test. * gfortran.dg/same_type_as_2.f03: Ditto. 2009-09-30 Janus Weil * gfortran.dg/select_type_1.f03: Extended. * gfortran.dg/select_type_3.f03: New test. 2009-09-30 Janus Weil * gfortran.dg/class_allocate_1.f03: New test. 2009-09-30 Janus Weil PR fortran/40996 * gfortran.dg/allocatable_scalar_3.f90: New test. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/typebound_proc_5.f03: Changed error messages. 2009-09-30 Janus Weil * gfortran.dg/block_name_2.f90: Modified error message. * gfortran.dg/select_6.f90: Ditto. * gfortran.dg/select_type_1.f03: New test. 2009-09-30 Janus Weil * gfortran.dg/allocate_derived_1.f90: Remove -w option. * gfortran.dg/class_1.f03: Ditto. * gfortran.dg/class_2.f03: Ditto. * gfortran.dg/proc_ptr_comp_pass_1.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_2.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_3.f90: Ditto. * gfortran.dg/typebound_call_10.f03: Ditto. * gfortran.dg/typebound_call_2.f03: Ditto. * gfortran.dg/typebound_call_3.f03: Ditto. * gfortran.dg/typebound_call_4.f03: Ditto. * gfortran.dg/typebound_call_9.f03: Ditto. * gfortran.dg/typebound_generic_3.f03: Ditto. * gfortran.dg/typebound_generic_4.f03: Ditto. * gfortran.dg/typebound_operator_1.f03: Ditto. * gfortran.dg/typebound_operator_2.f03: Ditto. * gfortran.dg/typebound_operator_3.f03: Ditto. * gfortran.dg/typebound_operator_4.f03: Ditto. * gfortran.dg/typebound_proc_1.f08: Ditto. * gfortran.dg/typebound_proc_5.f03: Ditto. * gfortran.dg/typebound_proc_6.f03: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152345 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index f53f75e3674..09b424c378f 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1173,6 +1173,13 @@ gfc_trans_code (gfc_code * code) res = gfc_trans_select (code); break; + case EXEC_SELECT_TYPE: + /* Do nothing. SELECT TYPE statements should be transformed into + an ordinary SELECT CASE at resolution stage. + TODO: Add an error message here once this is done. */ + res = NULL_TREE; + break; + case EXEC_FLUSH: res = gfc_trans_flush (code); break; -- cgit v1.2.1 From 39f3dea01a12406705751179d795b548b7393289 Mon Sep 17 00:00:00 2001 From: janus Date: Tue, 13 Oct 2009 16:12:24 +0000 Subject: 2009-10-13 Janus Weil PR fortran/41581 * decl.c (encapsulate_class_symbol): Add new component '$size'. * resolve.c (resolve_allocate_expr): Move CLASS handling to gfc_trans_allocate. (resolve_class_assign): Replaced by gfc_trans_class_assign. (resolve_code): Remove calls to resolve_class_assign. * trans.c (gfc_trans_code): Use new function gfc_trans_class_assign. * trans-expr.c (get_proc_ptr_comp): Fix a memory leak. (gfc_conv_procedure_call): For CLASS dummies, set the $size component. (gfc_trans_class_assign): New function, replacing resolve_class_assign. * trans-stmt.h (gfc_trans_class_assign): New prototype. * trans-stmt.c (gfc_trans_allocate): Use correct size when allocating CLASS variables. Do proper initialization. Move some code here from resolve_allocate_expr. 2009-10-13 Janus Weil PR fortran/41581 * gfortran.dg/class_allocate_2.f03: Modified. * gfortran.dg/class_allocate_3.f03: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152715 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 09b424c378f..22c3e076085 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1079,7 +1079,10 @@ gfc_trans_code (gfc_code * code) break; case EXEC_ASSIGN: - res = gfc_trans_assign (code); + if (code->expr1->ts.type == BT_CLASS) + res = gfc_trans_class_assign (code); + else + res = gfc_trans_assign (code); break; case EXEC_LABEL_ASSIGN: @@ -1087,7 +1090,10 @@ gfc_trans_code (gfc_code * code) break; case EXEC_POINTER_ASSIGN: - res = gfc_trans_pointer_assign (code); + if (code->expr1->ts.type == BT_CLASS) + res = gfc_trans_class_assign (code); + else + res = gfc_trans_pointer_assign (code); break; case EXEC_INIT_ASSIGN: -- cgit v1.2.1 From 1b013d97b21e27f9ce50324503d1115c272e19e2 Mon Sep 17 00:00:00 2001 From: janus Date: Mon, 26 Oct 2009 09:08:03 +0000 Subject: 2009-10-26 Janus Weil PR fortran/41714 * gimple.h (tree_annotate_all_with_location): Remove prototype. * gimplify.c (tree_should_carry_location_p, tree_annotate_one_with_location,tree_annotate_all_with_location): Remove obsolete functions. 2009-10-26 Janus Weil PR fortran/41714 * trans.c (gfc_trans_code): Remove call to 'tree_annotate_all_with_location'. Location should already be set. * trans-openmp.c (gfc_trans_omp_workshare): Ditto. * trans-stmt.c (gfc_trans_allocate): Do correct data initialization for CLASS variables with SOURCE tag, plus some cleanup. 2009-10-26 Janus Weil PR fortran/41714 * gfortran.dg/class_allocate_4.f03: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153547 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 22c3e076085..42d22388105 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1281,9 +1281,7 @@ gfc_trans_code (gfc_code * code) if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { - if (TREE_CODE (res) == STATEMENT_LIST) - tree_annotate_all_with_location (&res, input_location); - else + if (TREE_CODE (res) != STATEMENT_LIST) SET_EXPR_LOCATION (res, input_location); /* Add the new statement to the block. */ -- cgit v1.2.1 From 531692793cdfeb07aeac29c3daf772a401bc01d9 Mon Sep 17 00:00:00 2001 From: burnus Date: Mon, 4 Jan 2010 07:30:49 +0000 Subject: 2009-01-04 Tobias Burnus PR fortran/41872 * trans-expr.c (gfc_conv_procedure_call): Add indirect ref for functions returning allocatable scalars. * trans-stmt.c (gfc_trans_allocate): Emmit error when reallocating an allocatable scalar. * trans.c (gfc_allocate_with_status): Fix pseudocode syntax in comment. * trans-decl.c (gfc_trans_deferred_vars): Nullify local allocatable scalars. (gfc_generate_function_code): Nullify result variable for allocatable scalars. PR fortran/40849 * module.c (gfc_use_module): Fix warning string to allow for translation. PR fortran/42517 * invoke.texi (-fcheck=recursion): Mention that the checking is also disabled for -frecursive. * trans-decl.c (gfc_generate_function_code): Disable -fcheck=recursion when -frecursive is used. * intrinsic.texi (iso_c_binding): Improve wording. 2009-01-04 Tobias Burnus PR fortran/41872 * gfortran.dg/allocatable_scalar_5.f90: New test. * gfortran.dg/allocatable_scalar_6.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155606 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 42d22388105..a107392e094 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -711,6 +711,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) } else runtime_error ("Attempting to allocate already allocated array"); + } } expr must be set to the original expression being allocated for its locus -- cgit v1.2.1 From dba1636be4ca99a50e003734eb53decca6a57b4d Mon Sep 17 00:00:00 2001 From: janus Date: Sun, 31 Jan 2010 21:56:02 +0000 Subject: gcc/fortran/ 2010-01-31 Janus Weil PR fortran/42888 * resolve.c (resolve_allocate_expr): Move default initialization code here from gfc_trans_allocate. * trans.c (gfc_trans_code): Call gfc_trans_class_assign also for EXEC_INIT_ASSIGN. * trans-expr.c (gfc_trans_class_assign): Handle default initialization of CLASS variables via memcpy. * trans-stmt.c (gfc_trans_allocate): Move default initialization code to resolve_allocate_expr. gcc/testsuite/ 2010-01-31 Janus Weil PR fortran/42888 * gfortran.dg/allocate_derived_2.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156418 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index a107392e094..a5bb6418780 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1098,7 +1098,10 @@ gfc_trans_code (gfc_code * code) break; case EXEC_INIT_ASSIGN: - res = gfc_trans_init_assign (code); + if (code->expr1->ts.type == BT_CLASS) + res = gfc_trans_class_assign (code); + else + res = gfc_trans_init_assign (code); break; case EXEC_CONTINUE: -- cgit v1.2.1 From 1e8c7f7a67acb808ccc6f4e27bbd8e3b9ed06f26 Mon Sep 17 00:00:00 2001 From: jvdelisle Date: Sun, 14 Feb 2010 08:28:50 +0000 Subject: 2010-02-14 Jerry DeLisle PR fortran/32382 * trans-stmt.h: Add prototype for gfc_trans_code_cond. Add tree cond to gfc_trans_do prototype. * trans-stmt.c (gfc_trans_simple_do): Add optional argument to pass in a loop exit condition. If exit condition is given, build the loop exit code, checking IO results of implied do loops in READ and WRITE. (gfc_trans_do): Likewise. * trans.c (trans_code): New static work function, previously gfc_trans_code. Passes exit condition to gfc_trans_do. (gfc_trans_code): Calls trans_code with NULL_TREE condition. (gfc_trans_code_cond): Calls trans_code with loop exit condition. * trans-io.c (build_dt): Build an exit condition to allow checking IO result status bits in the dtparm structure. Use this condition in call to gfc_trans_code_cond. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156755 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index a5bb6418780..535e639faad 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1048,10 +1048,12 @@ gfc_set_backend_locus (locus * loc) } -/* Translate an executable statement. */ +/* Translate an executable statement. The tree cond is used by gfc_trans_do. + This static function is wrapped by gfc_trans_code_cond and + gfc_trans_code. */ -tree -gfc_trans_code (gfc_code * code) +static tree +trans_code (gfc_code * code, tree cond) { stmtblock_t block; tree res; @@ -1172,7 +1174,7 @@ gfc_trans_code (gfc_code * code) break; case EXEC_DO: - res = gfc_trans_do (code); + res = gfc_trans_do (code, cond); break; case EXEC_DO_WHILE: @@ -1298,6 +1300,25 @@ gfc_trans_code (gfc_code * code) } +/* Translate an executable statement with condition, cond. The condition is + used by gfc_trans_do to test for IO result conditions inside implied + DO loops of READ and WRITE statements. See build_dt in trans-io.c. */ + +tree +gfc_trans_code_cond (gfc_code * code, tree cond) +{ + return trans_code (code, cond); +} + +/* Translate an executable statement without condition. */ + +tree +gfc_trans_code (gfc_code * code) +{ + return trans_code (code, NULL_TREE); +} + + /* This function is called after a complete program unit has been parsed and resolved. */ -- cgit v1.2.1 From 3a60b071609ae5cda7e85eccf206659d3e75c00d Mon Sep 17 00:00:00 2001 From: burnus Date: Sat, 20 Feb 2010 08:31:25 +0000 Subject: 2010-02-20 Tobias Burnus PR fortran/42958 * libgfortran.h: Add GFC_RTCHECK_MEM. * invoke.texi (-fcheck=): Document -fcheck=mem. * tranc.c (gfc_call_malloc): Remove negative-size run-time error and enable malloc-success check only with -fcheck=mem. * option.c (gfc_handle_runtime_check_option): Add -fcheck=mem. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156923 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 535e639faad..6958f0272b5 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -497,13 +497,12 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock, /* Call malloc to allocate size bytes of memory, with special conditions: - + if size < 0, generate a runtime error, - + if size == 0, return a malloced area of size 1, + + if size <= 0, return a malloced area of size 1, + if malloc returns NULL, issue a runtime error. */ tree gfc_call_malloc (stmtblock_t * block, tree type, tree size) { - tree tmp, msg, negative, malloc_result, null_result, res; + tree tmp, msg, malloc_result, null_result, res; stmtblock_t block2; size = gfc_evaluate_now (size, block); @@ -514,18 +513,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) /* Create a variable to hold the result. */ res = gfc_create_var (prvoid_type_node, NULL); - /* size < 0 ? */ - negative = fold_build2 (LT_EXPR, boolean_type_node, size, - build_int_cst (size_type_node, 0)); - msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const - ("Attempt to allocate a negative amount of memory.")); - tmp = fold_build3 (COND_EXPR, void_type_node, negative, - build_call_expr_loc (input_location, - gfor_fndecl_runtime_error, 1, msg), - build_empty_stmt (input_location)); - gfc_add_expr_to_block (block, tmp); - - /* Call malloc and check the result. */ + /* Call malloc. */ gfc_start_block (&block2); size = fold_build2 (MAX_EXPR, size_type_node, size, @@ -535,15 +523,21 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) fold_convert (prvoid_type_node, build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MALLOC], 1, size))); - null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, - build_int_cst (pvoid_type_node, 0)); - msg = gfc_build_addr_expr (pchar_type_node, gfc_build_localized_cstring_const - ("Memory allocation failed")); - tmp = fold_build3 (COND_EXPR, void_type_node, null_result, - build_call_expr_loc (input_location, - gfor_fndecl_os_error, 1, msg), - build_empty_stmt (input_location)); - gfc_add_expr_to_block (&block2, tmp); + + /* Optionally check whether malloc was successful. */ + if (gfc_option.rtcheck & GFC_RTCHECK_MEM) + { + null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, + build_int_cst (pvoid_type_node, 0)); + msg = gfc_build_addr_expr (pchar_type_node, + gfc_build_localized_cstring_const ("Memory allocation failed")); + tmp = fold_build3 (COND_EXPR, void_type_node, null_result, + build_call_expr_loc (input_location, + gfor_fndecl_os_error, 1, msg), + build_empty_stmt (input_location)); + gfc_add_expr_to_block (&block2, tmp); + } + malloc_result = gfc_finish_block (&block2); gfc_add_expr_to_block (block, malloc_result); @@ -553,6 +547,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) return res; } + /* Allocate memory, using an optional status argument. This function follows the following pseudo-code: -- cgit v1.2.1 From 1384ae99ee84aa34f559ffb29468099e22d88dd2 Mon Sep 17 00:00:00 2001 From: pault Date: Thu, 1 Apr 2010 18:06:05 +0000 Subject: 2010-04-01 Paul Thomas * ioparm.def : Update copyright. * lang.opt : ditto * trans-array.c : ditto * trans-array.h : ditto * expr.c: ditto * trans-types.c: ditto * dependency.c : ditto * gfortran.h : ditto * options.c : ditto * trans-io.c : ditto * trans-intrinsic.c : ditto * libgfortran.h : ditto * invoke.texi : ditto * intrinsic.texi : ditto * trans.c : ditto * trans.h : ditto * intrinsic.c : ditto * interface.c : ditto * iresolve.c : ditto * trans-stmt.c : ditto * trans-stmt.h : ditto * parse,c : ditto * match.h : ditto * error.c : ditto git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157923 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 6958f0272b5..17241ac266c 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1,6 +1,6 @@ /* Code translation -- generate GCC trees from gfc_code. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free - Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. Contributed by Paul Brook This file is part of GCC. -- cgit v1.2.1 From c6cd3066bcb72a59fecce6bfa99cb4e169a4a751 Mon Sep 17 00:00:00 2001 From: burnus Date: Tue, 6 Apr 2010 16:26:02 +0000 Subject: 2010-04-06 Tobias Burnus PR fortran/39997 * intrinsic.c (add_functions): Add num_images. * decl.c (gfc_match_end): Handle END CRITICAL. * intrinsic.h (gfc_simplify_num_images): Add prototype. * dump-parse-tree.c (show_code_node): Dump CRITICAL, ERROR STOP, and SYNC. * gfortran.h (gfc_statement): Add enum items for those. (gfc_exec_op) Ditto. (gfc_isym_id): Add num_images. * trans-stmt.c (gfc_trans_stop): Handle ERROR STOP. (gfc_trans_sync,gfc_trans_critical): New functions. * trans-stmt.h (gfc_trans_stop,gfc_trans_sync, gfc_trans_critical): Add/update prototypes. * trans.c (gfc_trans_code): Handle CRITICAL, ERROR STOP, and SYNC statements. * trans.h (gfor_fndecl_error_stop_string) Add variable. * resolve.c (resolve_sync): Add function. (gfc_resolve_blocks): Handle CRITICAL. (resolve_code): Handle CRITICAL, ERROR STOP, (resolve_branch): Add CRITICAL constraint check. and SYNC statements. * st.c (gfc_free_statement): Add new statements. * trans-decl.c (gfor_fndecl_error_stop_string): Global variable. (gfc_build_builtin_function_decls): Initialize it. * match.c (gfc_match_if): Handle ERROR STOP and SYNC. (gfc_match_critical, gfc_match_error_stop, sync_statement, gfc_match_sync_all, gfc_match_sync_images, gfc_match_sync_memory): New functions. (match_exit_cycle): Handle CRITICAL constraint. (gfc_match_stopcode): Handle ERROR STOP. * match.h (gfc_match_critical, gfc_match_error_stop, gfc_match_sync_all, gfc_match_sync_images, gfc_match_sync_memory): Add prototype. * parse.c (decode_statement, gfc_ascii_statement, parse_executable): Handle new statements. (parse_critical_block): New function. * parse.h (gfc_compile_state): Add COMP_CRITICAL. * intrinsic.texi (num_images): Document new function. * simplify.c (gfc_simplify_num_images): Add function. 2010-04-06 Tobias Burnus PR fortran/39997 * gfortran.dg/coarray_1.f90: New test. * gfortran.dg/coarray_2.f90: New test. * gfortran.dg/coarray_3.f90: New test. 2010-04-06 Tobias Burnus PR fortran/39997 * runtime/stop.c (error_stop_string): New function. * gfortran.map (_gfortran_error_stop_string): Add. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158008 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 17241ac266c..c1993f90ddd 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1105,6 +1105,10 @@ trans_code (gfc_code * code, tree cond) res = NULL_TREE; break; + case EXEC_CRITICAL: + res = gfc_trans_critical (code); + break; + case EXEC_CYCLE: res = gfc_trans_cycle (code); break; @@ -1126,7 +1130,8 @@ trans_code (gfc_code * code, tree cond) break; case EXEC_STOP: - res = gfc_trans_stop (code); + case EXEC_ERROR_STOP: + res = gfc_trans_stop (code, code->op == EXEC_ERROR_STOP); break; case EXEC_CALL: @@ -1191,6 +1196,12 @@ trans_code (gfc_code * code, tree cond) res = gfc_trans_flush (code); break; + case EXEC_SYNC_ALL: + case EXEC_SYNC_IMAGES: + case EXEC_SYNC_MEMORY: + res = gfc_trans_sync (code, code->op); + break; + case EXEC_FORALL: res = gfc_trans_forall (code); break; -- cgit v1.2.1 From f10ca8ea5d9cb6a4dad0b1c64806be1baf3a5c5f Mon Sep 17 00:00:00 2001 From: kargl Date: Sat, 17 Apr 2010 21:05:53 +0000 Subject: 2010-04-17 Steven G. Kargl PR fortran/31538 * gfortran.dg/bounds_check_fail_4.f90: Adjust error message. * gfortran.dg/bounds_check_fail_3.f90: Ditto. 2010-04-17 Steven G. Kargl PR fortran/31538 * fortran/trans-array.c (gfc_conv_ss_startstride): Remove the use of gfc_msg_bounds by using 'Array bound mismatch' directly. (gfc_trans_dummy_array_bias): Remove the use of gfc_msg_bounds. Reword error message to include the mismatch in the extent of array bound. * fortran/trans.c: Remove gfc_msg_bounds. It is only used in one place. * fortran/trans.h: Remove extern definition of gfc_msg_bounds. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158474 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index c1993f90ddd..21c56045a44 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -47,7 +47,6 @@ along with GCC; see the file COPYING3. If not see static gfc_file *gfc_current_backend_file; -const char gfc_msg_bounds[] = N_("Array bound mismatch"); const char gfc_msg_fault[] = N_("Array reference out of bounds"); const char gfc_msg_wrong_return[] = N_("Incorrect function return value"); -- cgit v1.2.1 From 1e71b3148ebeba9ec268faca94fd38ba6827e988 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 14 May 2010 07:40:06 +0000 Subject: * trans.c (trans_code): Set backend locus early. * trans-decl.c (gfc_get_fake_result_decl): Use source location of the function instead of current input_location. * gfortran.dg/gomp/pr44036-1.f90: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159388 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 21c56045a44..8acccf85027 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1067,6 +1067,8 @@ trans_code (gfc_code * code, tree cond) gfc_add_expr_to_block (&block, res); } + gfc_set_backend_locus (&code->loc); + switch (code->op) { case EXEC_NOP: -- cgit v1.2.1 From bcc41e511c80b8b8aa549a438ffcac69481db979 Mon Sep 17 00:00:00 2001 From: janus Date: Sat, 15 May 2010 13:52:33 +0000 Subject: 2010-05-15 Janus Weil PR fortran/43207 PR fortran/43969 * gfortran.h (gfc_class_null_initializer): New prototype. * expr.c (gfc_class_null_initializer): New function to build a NULL initializer for CLASS pointers. * symbol.c (gfc_build_class_symbol): Modify internal naming of class containers. Remove default NULL initialization of $data component. * trans.c (gfc_allocate_array_with_status): Fix wording of an error message. * trans-expr.c (gfc_conv_initializer,gfc_trans_subcomponent_assign): Use new function 'gfc_class_null_initializer'. * trans-intrinsic.c (gfc_conv_allocated): Handle allocatable scalar class variables. 2010-05-15 Janus Weil PR fortran/43207 PR fortran/43969 * gfortran.dg/class_18.f03: New. * gfortran.dg/class_19.f03: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159431 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 8acccf85027..3a25bcc02d9 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -704,7 +704,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) return mem; } else - runtime_error ("Attempting to allocate already allocated array"); + runtime_error ("Attempting to allocate already allocated variable"); } } @@ -743,13 +743,13 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, error = gfc_trans_runtime_error (true, &expr->where, "Attempting to allocate already" - " allocated array '%s'", + " allocated variable '%s'", varname); } else error = gfc_trans_runtime_error (true, NULL, "Attempting to allocate already allocated" - "array"); + "variable"); if (status != NULL_TREE && !integer_zerop (status)) { -- cgit v1.2.1 From 989adef3b44d84f7b46c259ba46911460de87c51 Mon Sep 17 00:00:00 2001 From: steven Date: Thu, 20 May 2010 20:57:45 +0000 Subject: * trans-expr.c: Do not include convert.h, ggc.h, real.h, and gimple.h. (gfc_conv_string_tmp): Do not assert type comparibilty. * trans-array.c: Do not include gimple.h, ggc.h, and real.h. (gfc_conv_expr_descriptor): Remove assert. * trans-common.c: Clarify why rtl.h and tm.h are included. * trans-openmp.c: Do not include ggc.h and real.h. Explain why gimple.h is included. * trans-const.c: Do not include ggc.h. * trans-stmt.c: Do not include gimple.h, ggc.h, and real.h. * trans.c: Do not include ggc.h and real.h. Explain why gimple.h is included. * trans-types.c: Do not include tm.h. Explain why langhooks.h and dwarf2out.h are included. * trans-io.c: Do not include gimple.h and real.h. * trans-decl.c: Explain why gimple.h, tm.h, and rtl.h are included. * trans-intrinsic.c: Do not include gimple.h. Explain why tm.h is included. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159640 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 3a25bcc02d9..4c8a6d23eef 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -23,12 +23,10 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "gimple.h" +#include "gimple.h" /* For create_tmp_var_raw. */ #include "tree-iterator.h" -#include "ggc.h" #include "toplev.h" #include "defaults.h" -#include "real.h" #include "flags.h" #include "gfortran.h" #include "trans.h" -- cgit v1.2.1 From dca58d219480ce3c10fbc7442128ece6cc724d8f Mon Sep 17 00:00:00 2001 From: burnus Date: Sun, 23 May 2010 17:18:24 +0000 Subject: 2010-05-21 Tobias Burnus * gfortran.h: Do not include system.h. * bbt.c: Include system.h. * data.c: Ditto. * dependency.c: Ditto. * dump-parse-tree.c: Ditto. * arith.h: Do not include gfortran.h. * constructor.h: Do not include gfortran.h and splay-tree.h. * match.h: Do not include gfortran.h. * parse.h: Ditto. * target-memory.h: Ditto. * openmp.c: Do not include toplev.h and target.h. * trans-stmt.c: Ditto not include toplev.h. * primary.c: Ditto. * trans-common.c: Tell why toplev.h is needed. And do not include target.h. * trans-expr.c: Tell why toplev.h is needed. * trans-array.c: Ditto. * trans-openmp.c: Ditto. * trans-const.c: Ditto. * trans.c: Ditto. * trans-types.c: Ditto. * trans-io.c: Ditto. * trans-decl.c: Ditto. * scanner.c: Ditto. * convert.c: Ditto. * trans-intrinsic.c: Ditto. * options.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159763 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 4c8a6d23eef..43b69d5a2b0 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "gimple.h" /* For create_tmp_var_raw. */ #include "tree-iterator.h" -#include "toplev.h" +#include "toplev.h" /* For internal_error. */ #include "defaults.h" #include "flags.h" #include "gfortran.h" -- cgit v1.2.1 From 7cbc820e16a5c752351dd7db7150b2f128bc21e1 Mon Sep 17 00:00:00 2001 From: burnus Date: Tue, 6 Jul 2010 19:57:29 +0000 Subject: 2010-07-06 Tobias Burnus * trans-decl.c: Include diagnostic-core.h besides toplev.h. * trans-intrinsic.c: Ditto. * trans-types.c: Ditto. * convert.c: Include diagnostic-core.h instead of toplev.h. * options.c: Ditto. * trans-array.c: Ditto. * trans-const.c: Ditto. * trans-expr.c: Ditto. * trans-io.c: Ditto. * trans-openmp.c: Ditto. * trans.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161885 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 43b69d5a2b0..f97e7391b22 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "gimple.h" /* For create_tmp_var_raw. */ #include "tree-iterator.h" -#include "toplev.h" /* For internal_error. */ +#include "diagnostic-core.h" /* For internal_error. */ #include "defaults.h" #include "flags.h" #include "gfortran.h" -- cgit v1.2.1 From c5faa79924f2b5c58fd21b6bd2416836985dfc25 Mon Sep 17 00:00:00 2001 From: domob Date: Thu, 15 Jul 2010 12:23:47 +0000 Subject: 2010-07-15 Daniel Kraft PR fortran/44709 * trans.h (struct gfc_wrapped_block): New struct. (gfc_start_wrapped_block), (gfc_add_init_cleanup): New methods. (gfc_finish_wrapped_block): New method. (gfc_init_default_dt): Add new init code to block rather than returning it. * trans-array.h (gfc_trans_auto_array_allocation): Use gfc_wrapped_block (gfc_trans_dummy_array_bias): Ditto. (gfc_trans_g77_array): Ditto. (gfc_trans_deferred_array): Ditto. * trans.c (gfc_add_expr_to_block): Call add_expr_to_chain. (add_expr_to_chain): New method based on old gfc_add_expr_to_block. (gfc_start_wrapped_block), (gfc_add_init_cleanup): New methods. (gfc_finish_wrapped_block): New method. * trans-array.c (gfc_trans_auto_array_allocation): use gfc_wrapped_block (gfc_trans_g77_array), (gfc_trans_dummy_array_bias): Ditto. (gfc_trans_deferred_array): Ditto. * trans-decl.c (gfc_trans_dummy_character): Ditto. (gfc_trans_auto_character_variable), (gfc_trans_assign_aux_var): Ditto. (init_intent_out_dt): Ditto. (gfc_init_default_dt): Add new init code to block rather than returning it. (gfc_trans_deferred_vars): Use gfc_wrapped_block to collect all init and cleanup code and put it all together. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162219 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 94 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 13 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index f97e7391b22..4b20b962fba 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -977,31 +977,47 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size) return res; } -/* Add a statement to a block. */ -void -gfc_add_expr_to_block (stmtblock_t * block, tree expr) -{ - gcc_assert (block); +/* Add an expression to another one, either at the front or the back. */ +static void +add_expr_to_chain (tree* chain, tree expr, bool front) +{ if (expr == NULL_TREE || IS_EMPTY_STMT (expr)) return; - if (block->head) + if (*chain) { - if (TREE_CODE (block->head) != STATEMENT_LIST) + if (TREE_CODE (*chain) != STATEMENT_LIST) { tree tmp; - tmp = block->head; - block->head = NULL_TREE; - append_to_statement_list (tmp, &block->head); + tmp = *chain; + *chain = NULL_TREE; + append_to_statement_list (tmp, chain); } - append_to_statement_list (expr, &block->head); + + if (front) + { + tree_stmt_iterator i; + + i = tsi_start (*chain); + tsi_link_before (&i, expr, TSI_CONTINUE_LINKING); + } + else + append_to_statement_list (expr, chain); } else - /* Don't bother creating a list if we only have a single statement. */ - block->head = expr; + *chain = expr; +} + +/* Add a statement to a block. */ + +void +gfc_add_expr_to_block (stmtblock_t * block, tree expr) +{ + gcc_assert (block); + add_expr_to_chain (&block->head, expr, false); } @@ -1393,3 +1409,55 @@ gfc_generate_module_code (gfc_namespace * ns) } } + +/* Initialize an init/cleanup block with existing code. */ + +void +gfc_start_wrapped_block (gfc_wrapped_block* block, tree code) +{ + gcc_assert (block); + + block->init = NULL_TREE; + block->code = code; + block->cleanup = NULL_TREE; +} + + +/* Add a new pair of initializers/clean-up code. */ + +void +gfc_add_init_cleanup (gfc_wrapped_block* block, tree init, tree cleanup) +{ + gcc_assert (block); + + /* The new pair of init/cleanup should be "wrapped around" the existing + block of code, thus the initialization is added to the front and the + cleanup to the back. */ + add_expr_to_chain (&block->init, init, true); + add_expr_to_chain (&block->cleanup, cleanup, false); +} + + +/* Finish up a wrapped block by building a corresponding try-finally expr. */ + +tree +gfc_finish_wrapped_block (gfc_wrapped_block* block) +{ + tree result; + + gcc_assert (block); + + /* Build the final expression. For this, just add init and body together, + and put clean-up with that into a TRY_FINALLY_EXPR. */ + result = block->init; + add_expr_to_chain (&result, block->code, false); + if (block->cleanup) + result = build2 (TRY_FINALLY_EXPR, void_type_node, result, block->cleanup); + + /* Clear the block. */ + block->init = NULL_TREE; + block->code = NULL_TREE; + block->cleanup = NULL_TREE; + + return result; +} -- cgit v1.2.1 From 1767a056f10a2ccbc900df04d01193da73a3d272 Mon Sep 17 00:00:00 2001 From: froydnj Date: Thu, 15 Jul 2010 14:31:28 +0000 Subject: gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162223 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/trans.c') diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 4b20b962fba..003f6090c2f 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -57,7 +57,7 @@ gfc_advance_chain (tree t, int n) for (; n > 0; n--) { gcc_assert (t != NULL_TREE); - t = TREE_CHAIN (t); + t = DECL_CHAIN (t); } return t; } @@ -218,8 +218,8 @@ gfc_merge_block_scope (stmtblock_t * block) /* Add them to the parent scope. */ while (decl != NULL_TREE) { - next = TREE_CHAIN (decl); - TREE_CHAIN (decl) = NULL_TREE; + next = DECL_CHAIN (decl); + DECL_CHAIN (decl) = NULL_TREE; pushdecl (decl); decl = next; -- cgit v1.2.1