https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99798
Bug ID: 99798 Summary: ICE when compiling a variant of pr87907 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dominiq at lps dot ens.fr Target Milestone: --- Compiling the following variant of pr87907 module m interface module integer function g(x) integer, intent(in) :: x end end interface end submodule(m) m2 contains subroutine g(x) ! { dg-error "mismatch in argument" } integer, intent(in) :: x end end gives % gfc pr87907_db_2.f90 pr87907_db_2.f90:10:15: 10 | subroutine g(x) ! { dg-error "mismatch in argument" } | 1 Error: FUNCTION attribute conflicts with SUBROUTINE attribute in 'g' at (1) pr87907_db_2.f90:11:29: 11 | integer, intent(in) :: x | 1 Error: Unexpected data declaration statement in CONTAINS section at (1) f951: internal compiler error: Segmentation fault: 11 The backtrace is * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x106) * frame #0: 0x00000001000ec2b9 f951`gfc_free_statements(p=0x00000000000000f6) at st.c:295:9 frame #1: 0x00000001000f53f7 f951`gfc_free_namespace(ns=0x000000014500be00) at symbol.c:4039:23 frame #2: 0x00000001000f5a29 f951`gfc_free_symbol(gfc_symbol*) at symbol.c:4037:3 frame #3: 0x00000001000f59fc f951`gfc_free_symbol(sym=0x0000000142f0ba50) frame #4: 0x00000001000f53b2 f951`::free_sym_tree(sym_tree=0x0000000142f0ba20) at symbol.c:3902:22 frame #5: 0x00000001000f5400 f951`gfc_free_namespace(ns=0x000000014500a200) at symbol.c:4041:17 frame #6: 0x00000001000f7034 f951`gfc_symbol_done_2() at symbol.c:4037:3 frame #7: 0x00000001000f7016 f951`gfc_symbol_done_2() frame #8: 0x0000000100084689 f951`gfc_done_2() at misc.c:380:21 frame #9: 0x00000001000a422a f951`::clean_up_modules(gsym=0x0000000142f0b600) at parse.c:6311:14 frame #10: 0x00000001000b2e17 f951`gfc_parse_file() at parse.c:6374:20 frame #11: 0x000000010010d987 f951`::gfc_be_parse_file() at f95-lang.c:212:18 frame #12: 0x0000000100d1a294 f951`::compile_file() at toplev.c:457:25 frame #13: 0x000000010120dd9f f951`toplev::main(int, char**) at toplev.c:2201:24 frame #14: 0x000000010120da5e f951`toplev::main(this=0x00007ffeefbff09e, argc=<unavailable>, argv=<unavailable>) frame #15: 0x000000010120ffb1 f951`main(argc=2, argv=0x00007ffeefbff0d0) at main.c:39:22 frame #16: 0x00007fff2066d621 libdyld.dylib`start + 1