diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 33 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 5 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 6 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 3 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 5 | ||||
-rw-r--r-- | gcc/fortran/trans.c | 14 |
6 files changed, 49 insertions, 17 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f78663e6dd1..b752efb264d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,36 @@ +2012-06-14 Tobias Burnus <burnus@net-b.de> + + PR fortran/53597 + * decl.c (match_attr_spec): Only mark module variables + as SAVE_IMPLICIT for Fortran 2008 and later. + +2012-06-05 Tobias Burnus <burnus@net-b.de> + + PR fortran/50619 + * resolve.c (build_default_init_expr): Don't initialize + ASSOCIATE names. + +2012-06-01 Tobias Burnus <burnus@net-b.de> + + PR fortran/53521 + * trans.c (gfc_deallocate_scalar_with_status): Properly + handle the case size == 0. + +2012-05-23 Tobias Burnus <burnus@net-b.de> + + PR fortran/53389 + * trans-array.c (gfc_add_loop_ss_code): Don't evaluate + expression, if ss->is_alloc_lhs is set. + +2012-05-02 Tobias Burnus <burnus@net-b.de> + + Backport from mainline + 2012-04-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/52864 + * expr.c (gfc_check_vardef_context): Fix assignment check for + pointer components. + 2012-03-10 Tobias Burnus <burnus@net-b.de> PR fortran/52469 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 90693a4b858..26bffb78baf 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -3623,8 +3623,9 @@ match_attr_spec (void) } } - /* Module variables implicitly have the SAVE attribute. */ - if (gfc_current_state () == COMP_MODULE && !current_attr.save) + /* Since Fortran 2008 module variables implicitly have the SAVE attribute. */ + if (gfc_current_state () == COMP_MODULE && !current_attr.save + && (gfc_option.allow_std & GFC_STD_F2008) != 0) current_attr.save = SAVE_IMPLICIT; colon_seen = 1; diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index a4da37c20dc..3330cc89313 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4474,7 +4474,11 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context) if (ptr_component && ref->type == REF_COMPONENT) check_intentin = false; if (ref->type == REF_COMPONENT && ref->u.c.component->attr.pointer) - ptr_component = true; + { + ptr_component = true; + if (!pointer) + check_intentin = false; + } } if (check_intentin && sym->attr.intent == INTENT_IN) { diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 4ee70932bc8..3e795ce1639 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -9700,7 +9700,8 @@ build_default_init_expr (gfc_symbol *sym) || sym->attr.data || sym->module || sym->attr.cray_pointee - || sym->attr.cray_pointer) + || sym->attr.cray_pointer + || sym->assoc) return NULL; /* Now we'll try to build an initializer expression. */ diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a4be6e7b165..d0d0900eb1d 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -2056,6 +2056,11 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript, gfc_se se; int n; + /* Don't evaluate the arguments for realloc_lhs_loop_for_fcn_call; otherwise, + arguments could get evaluated multiple times. */ + if (ss->is_alloc_lhs) + return; + /* TODO: This can generate bad code if there are ordering dependencies, e.g., a callee allocated function and an unknown size constructor. */ gcc_assert (ss != NULL); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 27a352ab3bd..0dc82409833 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1005,15 +1005,12 @@ internal_realloc (void *mem, size_t size) if (!res && size != 0) _gfortran_os_error ("Allocation would exceed memory limit"); - if (size == 0) - return NULL; - return res; } */ tree gfc_call_realloc (stmtblock_t * block, tree mem, tree size) { - tree msg, res, nonzero, zero, null_result, tmp; + tree msg, res, nonzero, null_result, tmp; tree type = TREE_TYPE (mem); size = gfc_evaluate_now (size, block); @@ -1044,15 +1041,6 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size) build_empty_stmt (input_location)); gfc_add_expr_to_block (block, tmp); - /* if (size == 0) then the result is NULL. */ - tmp = fold_build2_loc (input_location, MODIFY_EXPR, type, res, - build_int_cst (type, 0)); - zero = fold_build1_loc (input_location, TRUTH_NOT_EXPR, boolean_type_node, - nonzero); - tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, zero, tmp, - build_empty_stmt (input_location)); - gfc_add_expr_to_block (block, tmp); - return res; } |