[Bug fortran/49648] ICE(segfault) with MATMUL and function-result actual argument
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 6 14:25:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49648
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> 2011-07-06 14:25:10 UTC ---
Here is a "fix".
The important part I suppose is that one has to apply resolve_symbol on
sym->result. It is the case before the patch, only if the symbol has unknown
type.
diff --git a/resolve.c b/resolve.c
index f484a22..908e72b 100644
--- a/resolve.c
+++ b/resolve.c
@@ -12181,21 +12181,22 @@ resolve_symbol (gfc_symbol *sym)
in the case that there is no implicit type. */
if (!mp_flag)
gfc_set_default_type (sym, sym->attr.external, NULL);
- else
- {
- /* Result may be in another namespace. */
- resolve_symbol (sym->result);
+ }
+ }
- if (!sym->result->attr.proc_pointer)
- {
- sym->ts = sym->result->ts;
- sym->as = gfc_copy_array_spec (sym->result->as);
- sym->attr.dimension = sym->result->attr.dimension;
- sym->attr.pointer = sym->result->attr.pointer;
- sym->attr.allocatable = sym->result->attr.allocatable;
- sym->attr.contiguous = sym->result->attr.contiguous;
- }
- }
+ if (mp_flag && sym->attr.flavor == FL_PROCEDURE && sym->attr.function)
+ {
+ /* Result may be in another namespace. */
+ resolve_symbol (sym->result);
+
+ if (!sym->result->attr.proc_pointer)
+ {
+ sym->ts = sym->result->ts;
+ sym->as = gfc_copy_array_spec (sym->result->as);
+ sym->attr.dimension = sym->result->attr.dimension;
+ sym->attr.pointer = sym->result->attr.pointer;
+ sym->attr.allocatable = sym->result->attr.allocatable;
+ sym->attr.contiguous = sym->result->attr.contiguous;
}
}
More information about the Gcc-bugs
mailing list