https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128344
Harald Anlauf <anlauf at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
--- Comment #2 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
Reduced testcase (converted to a module), which is valid and ICEs:
module foo
interface iii
module procedure :: iii,ii2
end interface iii
contains
subroutine iii(n)
integer, intent(out) :: n
n = 2
end subroutine iii
subroutine ii2(k,n)
integer, intent(in) :: k
integer, intent(out) :: n
n = k
end subroutine ii2
subroutine sub(ii2,iii)
integer :: i
call iii(i)
if (i.ne.2) print *,'err1'
call ii2(1,i)
if (i.ne.1) print *,'err2'
end subroutine sub
end
All version down to (at least) 13 ICE here; for 17 I get:
Segmentation fault
0x3e6c913 internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x1bb60fb crash_signal
../../gcc-trunk/gcc/toplev.cc:325
0x3f1436f pp_quoted_string
../../gcc-trunk/gcc/pretty-print.cc:2822
0x3f11fef format_phase_2
../../gcc-trunk/gcc/pretty-print.cc:2168
0x3f107a8 pretty_printer::format(text_info&)
../../gcc-trunk/gcc/pretty-print.cc:1846
0x12f15ae pp_format(pretty_printer*, text_info*)
../../gcc-trunk/gcc/pretty-print.h:599
0x3e7c265
diagnostics::context::report_diagnostic(diagnostics::diagnostic_info*)
../../gcc-trunk/gcc/diagnostics/context.cc:1530
0x1036e65 diagnostic_report_diagnostic(diagnostics::context*,
diagnostics::diagnostic_info*)
../../gcc-trunk/gcc/diagnostic.h:178
0x1064dd2 gfc_report_diagnostic
../../gcc-trunk/gcc/fortran/error.cc:251
0x10668c8 gfc_internal_error(char const*, ...)
../../gcc-trunk/gcc/fortran/error.cc:842
0x10d293c write_symbol
../../gcc-trunk/gcc/fortran/module.cc:6612
0x10d3158 write_symbol1_recursion
../../gcc-trunk/gcc/fortran/module.cc:6898
0x10d317a write_symbol1_recursion
../../gcc-trunk/gcc/fortran/module.cc:6901
0x10d31d0 write_symbol1
../../gcc-trunk/gcc/fortran/module.cc:6931
0x10d36c0 write_module
../../gcc-trunk/gcc/fortran/module.cc:7104
0x10d3ac2 dump_module
../../gcc-trunk/gcc/fortran/module.cc:7233
0x10d3cd3 gfc_dump_module(char const*, int)
../../gcc-trunk/gcc/fortran/module.cc:7290
0x1127978 gfc_parse_file()
../../gcc-trunk/gcc/fortran/parse.cc:7912
0x11a2080 gfc_be_parse_file
../../gcc-trunk/gcc/fortran/f95-lang.cc:251
Without conversion to module, the following does not ICE, but has also lots
of valgrind invalid reads:
interface iii
procedure :: iii,ii2
end interface iii
contains
subroutine iii(n)
integer, intent(out) :: n
n = 2
end subroutine iii
subroutine ii2(k,n)
integer, intent(in) :: k
integer, intent(out) :: n
n = k
end subroutine ii2
subroutine sub(ii2,iii)
integer :: i
call iii(i)
if (i.ne.2) print *,'err1'
call ii2(1,i)
if (i.ne.1) print *,'err2'
end subroutine sub
end
==3061679== Invalid read of size 4
==3061679== at 0x12DD1C3: gfc_get_function_type(gfc_symbol*,
gfc_actual_arglist*, char const*) (trans-types.cc:3491)
==3061679== by 0x11F9213: build_function_decl(gfc_symbol*, bool)
(trans-decl.cc:2629)
==3061679== by 0x11FC61B: gfc_create_function_decl(gfc_namespace*, bool)
(trans-decl.cc:3450)
==3061679== by 0x12083D9: gfc_generate_contained_functions(gfc_namespace*)
(trans-decl.cc:6506)
==3061679== by 0x120F65D: gfc_generate_function_code(gfc_namespace*)
(trans-decl.cc:8346)
==3061679== by 0x11BDAB0: gfc_generate_code(gfc_namespace*) (trans.cc:2769)
==3061679== by 0x112745E: translate_all_program_units(gfc_namespace*)
(parse.cc:7751)
==3061679== by 0x1127DE7: gfc_parse_file() (parse.cc:8081)
==3061679== by 0x11A2080: gfc_be_parse_file() (f95-lang.cc:251)
==3061679== by 0x1BB6542: compile_file() (toplev.cc:455)
==3061679== by 0x1BB9ADE: do_compile() (toplev.cc:2228)
==3061679== by 0x1BB9F42: toplev::main(int, char**) (toplev.cc:2396)
[...lots of output elided...]
Looks like Pandora's box...