This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49648] ICE(segfault) with MATHMUL and function-result actual argument
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 5 Jul 2011 19:47:03 +0000
- Subject: [Bug fortran/49648] ICE(segfault) with MATHMUL and function-result actual argument
- Auto-submitted: auto-generated
- References: <bug-49648-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49648
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-05 19:46:45 UTC ---
Draft patch, which should also save some memory, .mod file-size and should
slightly speed the program.
It fixes the test case in comment 0 and comment 2, but I have not yet regtested
it (currently bootstrapping). A modification would be to not write it at all -
and simply add "sym->result = sym" if sym->attr.function. (This will break .mod
compatibility, which was last done 2011-03-29 - though I am not 100% sure that
4.6 and 4.7 are indeed still compatible.)
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3631,7 +3637,10 @@ mio_symbol (gfc_symbol *sym)
mio_array_spec (&sym->as);
- mio_symbol_ref (&sym->result);
+ if (iomode == IO_OUTPUT && sym->result != sym)
+ mio_symbol_ref (&sym);
+ else
+ mio_symbol_ref (&sym->result);
if (sym->attr.cray_pointee)
mio_symbol_ref (&sym->cp_pointer);