diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-06 08:48:41 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-06 08:48:41 +0000 |
commit | 13c89565e8b716fac8521f5195b23c7cb9f818c1 (patch) | |
tree | 5eb865f1df000c3e6a1e5940dd746e10912f11bd /gcc/fortran | |
parent | 194589c5f6dc71acb90ab653830bbc32898ad7a2 (diff) | |
download | gcc-13c89565e8b716fac8521f5195b23c7cb9f818c1.tar.gz |
2012-02-03 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 183926 using svnmerge
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@183929 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 3 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 16 | ||||
-rw-r--r-- | gcc/fortran/trans-stmt.c | 8 |
4 files changed, 42 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index db369ab0feb..4cde6e2beae 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,21 @@ +2012-02-05 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/48847 + * trans-decl.c: Warn about unused dummy procedure arguments + if -Wunused-dummy-argument is specified. Suppress middle-end + warnings about procedure arguments. + +2012-02-05 Paul Thomas <pault@gcc.gnu.org> + + * trans-array.c (gfc_array_allocate): Zero memory for all class + array allocations. + * trans-stmt.c (gfc_trans_allocate): Ditto for class scalars. + + PR fortran/52102 + * trans-stmt.c (gfc_trans_allocate): Before correcting a class + array reference, ensure that 'dataref' points to the _data + component that is followed by the array reference.. + 2012-02-02 Mikael Morin <mikael@gcc.gnu.org> PR fortran/41587 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index d3c81a82ab8..edcde5c4c0c 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5111,8 +5111,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, gfc_add_expr_to_block (&se->pre, tmp); - if (expr->ts.type == BT_CLASS - && (expr3_elem_size != NULL_TREE || expr3)) + if (expr->ts.type == BT_CLASS) { tmp = build_int_cst (unsigned_char_type_node, 0); /* With class objects, it is best to play safe and null the diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index cb8f613813e..e497fd6ede3 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -4683,6 +4683,22 @@ generate_local_decl (gfc_symbol * sym) && sym->ts.type == BT_CHARACTER && sym->ts.is_c_interop && sym->ns->proc_name != NULL && sym->ns->proc_name->attr.is_bind_c) gfc_conv_scalar_char_value (sym, NULL, NULL); + + /* Unused procedure passed as dummy argument. */ + if (sym->attr.flavor == FL_PROCEDURE) + { + if (!sym->attr.referenced) + { + if (gfc_option.warn_unused_dummy_argument) + gfc_warning ("Unused dummy argument '%s' at %L", sym->name, + &sym->declared_at); + } + + /* Silence bogus "unused parameter" warnings from the + middle end. */ + if (sym->backend_decl != NULL_TREE) + TREE_NO_WARNING (sym->backend_decl) = 1; + } } /* Make sure we convert the types of the derived types from iso_c_binding diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 7a6f8b2b419..7d094b0311e 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -4957,7 +4957,7 @@ gfc_trans_allocate (gfc_code * code) tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, tmp, 0); gfc_add_expr_to_block (&se.pre, tmp); } - else if (al->expr->ts.type == BT_CLASS && code->expr3) + else if (al->expr->ts.type == BT_CLASS) { /* With class objects, it is best to play safe and null the memory because we cannot know if dynamic types have allocatable @@ -5076,7 +5076,13 @@ gfc_trans_allocate (gfc_code * code) actual->next->expr = gfc_copy_expr (al->expr); actual->next->expr->ts.type = BT_CLASS; gfc_add_data_component (actual->next->expr); + dataref = actual->next->expr->ref; + /* Make sure we go up through the reference chain to + the _data reference, where the arrayspec is found. */ + while (dataref->next && dataref->next->type != REF_ARRAY) + dataref = dataref->next; + if (dataref->u.c.component->as) { int dim; |