[Bug fortran/68237] ICE on invalid with submodules
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 13 18:58:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68237
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #8 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #7)
> > This slightly changed test case should demonstrate the problem:
>
> Confirmed, the backtrace is
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000001000288c7 in gfc_match_submod_proc () at
> ../../work/gcc/fortran/decl.c:7649
> 7649 if (sym->ts.interface->attr.function)
> (gdb) bt
> #0 0x00000001000288c7 in gfc_match_submod_proc () at
> ../../work/gcc/fortran/decl.c:7649
> #1 0x0000000100082e8d in decode_statement () at
> ../../work/gcc/fortran/parse.c:384
> #2 0x0000000100084bc5 in next_statement () at
> ../../work/gcc/fortran/parse.c:1075
> #3 0x000000010008b0f4 in parse_contained (module=<optimized out>) at
> ../../work/gcc/fortran/parse.c:4990
> #4 0x000000010008c1df in parse_module () at
> ../../work/gcc/fortran/parse.c:5390
> #5 0x000000010008cc43 in gfc_parse_file () at
> ../../work/gcc/fortran/parse.c:5696
> #6 0x00000001000d39db in gfc_be_parse_file () at
> ../../work/gcc/fortran/f95-lang.c:205
> #7 0x0000000100aec62a in compile_file () at ../../work/gcc/toplev.c:466
> #8 0x0000000100fc173c in ?? ()
> #9 0x0000000100fc30f9 in main (argc=2, argv=0x7fff5fbff308) at
> ../../work/gcc/main.c:39
This patch
Index: decl.c
===================================================================
--- decl.c (revision 230336)
+++ decl.c (working copy)
@@ -7650,7 +7666,7 @@ gfc_match_submod_proc (void)
/* Make sure that the result field is appropriately filled, even though
the result symbol will be replaced later on. */
- if (sym->ts.interface->attr.function)
+ if (sym->ts.interface && sym->ts.interface->attr.function)
{
if (sym->ts.interface->result
&& sym->ts.interface->result != sym->ts.interface)
yields
troutmask:sgk[215] gfc6 -c k1.f90
k1.f90:14:19:
module procedure foo
1
Error: MODULE PROCEDURE at (1) must be in a generic module interface
k1.f90:15:6:
end procedure
1
Error: Expecting END SUBMODULE statement at (1)
Have no idea if it is correct. pault?
More information about the Gcc-bugs
mailing list