https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88099
Bug ID: 88099
Summary: ICE in maybe_legitimize_operand, at optabs.c:7170
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
With -fsanitize=undefined or a test version (--enable-checking=yes) :
(n2 is not a function reference due to missing "()", and not initialized)
$ cat z1.f90
module m
contains
function n1()
n1 = 3
n1 = n1 + n2
end
function n2()
n2 = 4
end
end
$ gfortran-9-20181118 -c z1.f90 -O2
$ gfortran-9-20181118 -c z1.f90 -g -O0 -Wall -Wextra -fcheck=all
$
$ gfortran-9-20181118 -c z1.f90 -fsanitize=undefined
during RTL pass: expand
z1.f90:5:0:
5 | n1 = n1 + n2
|
internal compiler error: in maybe_legitimize_operand, at optabs.c:7170
0xa4098a maybe_legitimize_operand
../../gcc/optabs.c:7169
0xa4098a maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
../../gcc/optabs.c:7298
0xa40b89 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
../../gcc/optabs.c:7317
0xa43ed8 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
../../gcc/optabs.c:7360
0x94ad5f expand_addsub_overflow
../../gcc/internal-fn.c:1005
0x9500e7 expand_UBSAN_CHECK_ADD
../../gcc/internal-fn.c:2193
0x77bd87 expand_call_stmt
../../gcc/cfgexpand.c:2622
0x77bd87 expand_gimple_stmt_1
../../gcc/cfgexpand.c:3650
0x77bd87 expand_gimple_stmt
../../gcc/cfgexpand.c:3809
0x77dc87 expand_gimple_basic_block
../../gcc/cfgexpand.c:5845
0x7832c6 execute
../../gcc/cfgexpand.c:6450
$ gfortran-9-20181118-chk -c z1.f90
z1.f90:3:0:
3 | function n1()
|
Error: invalid (pointer) operands to plus/minus
_2 = __result_n1.0_1 + n2;
z1.f90:3:0: internal compiler error: verify_gimple failed
0xcccbdd verify_gimple_in_seq(gimple*)
../../gcc/tree-cfg.c:5082
0x9e0a45 gimplify_body(tree_node*, bool)
../../gcc/gimplify.c:13636
0x9e0d34 gimplify_function_tree(tree_node*)
../../gcc/gimplify.c:13726
0x82b6f7 cgraph_node::analyze()
../../gcc/cgraphunit.c:667
0x82e8e9 analyze_functions
../../gcc/cgraphunit.c:1126
0x82f9c2 symbol_table::finalize_compilation_unit()
../../gcc/cgraphunit.c:2835