This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] fortran/41918 -- silence a warning
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 3 Nov 2009 15:01:48 -0800
- Subject: [PATCH] fortran/41918 -- silence a warning
The patch has been built and regtested on x86_64-*-freebsd.
There are no regression. I'm not sure if this will silence
all possible warnings where a default initialization can
occur, but it catches those in my tet program.
2009-11-03 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/41918
* fortran/trans-decl.c: Silence intent(out) warning for derived type
dummy arguments with default initialization.
--
Steve
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 153823)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -3776,8 +3776,12 @@ generate_local_decl (gfc_symbol * sym)
else if (warn_unused_variable
&& sym->attr.dummy
&& sym->attr.intent == INTENT_OUT)
- gfc_warning ("Dummy argument '%s' at %L was declared INTENT(OUT) but was not set",
- sym->name, &sym->declared_at);
+ {
+ if (!(sym->ts.type == BT_DERIVED
+ && sym->ts.u.derived->components->initializer))
+ gfc_warning ("Dummy argument '%s' at %L was declared INTENT(OUT) "
+ "but was not set", sym->name, &sym->declared_at);
+ }
/* Specific warning for unused dummy arguments. */
else if (warn_unused_variable && sym->attr.dummy)
gfc_warning ("Unused dummy argument '%s' at %L", sym->name,