https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94121
Bug ID: 94121 Summary: ICE on aarch64-linux-gnu: in abs_hwi, at hwint.h:324 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: lizekun1 at huawei dot com Target Milestone: --- I find an ICE when testing GCC10.0 on aarch64 at -O2 -fpie with POC below: --- #define DIFF_MAX __PTRDIFF_MAX__ #define DIFF_MIN (-DIFF_MAX - 1) extern void foo (); void test_global_char_array (void) { extern char gcar3[1]; char *p = gcar3; foo (&p[DIFF_MIN]); } --- GCC version: gcc version 10.0.1 20200302 (experimental) Runcommand: gcc poc.c -O2 -fpie -fno-diagnostics-show-caret -S -o poc.s Stack dump: internal compiler error: in abs_hwi, at hwint.h:324 0xf477f3 abs_hwi(long) gcc-10.0/gcc/hwint.h:324 0x18078ef aarch64_add_offset_1 gcc-10.0/gcc/config/aarch64/aarch64.c:3716 0x18089bf aarch64_add_offset gcc-10.0/gcc/config/aarch64/aarch64.c:4002 0x180a7df aarch64_expand_mov_immediate(rtx_def*, rtx_def*) gcc-10.0/gcc/config/aarch64/aarch64.c:4632 0x1d0f87b gen_movdi(rtx_def*, rtx_def*) gcc-10.0/gcc/config/aarch64/aarch64.md:1196 0xd9547b insn_gen_fn::operator()(rtx_def*, rtx_def*) const gcc-10.0/gcc/recog.h:317 0xd6e813 emit_move_insn_1(rtx_def*, rtx_def*) gcc-10.0/gcc/expr.c:3754 0xd6ee2f emit_move_insn(rtx_def*, rtx_def*) gcc-10.0/gcc/expr.c:3850 0xba4d9f load_register_parameters gcc-10.0/gcc/calls.c:3147 0xba8ac3 expand_call(tree_node*, rtx_def*, int) gcc-10.0/gcc/calls.c:4593 0xd8e0bf expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) gcc-10.0/gcc/expr.c:11130 0xd80d57 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) gcc-10.0/gcc/expr.c:8353 0xbc50d7 expand_expr gcc-10.0/gcc/expr.h:282 0xbcf023 expand_call_stmt gcc-10.0/gcc/cfgexpand.c:2703 0xbd2783 expand_gimple_stmt_1 gcc-10.0/gcc/cfgexpand.c:3682 0xbd2ef7 expand_gimple_stmt gcc-10.0/gcc/cfgexpand.c:3847 0xbd2fff expand_gimple_tailcall gcc-10.0/gcc/cfgexpand.c:3893 0xbdbb4b expand_gimple_basic_block gcc-10.0/gcc/cfgexpand.c:5864 0xbddaf7 execute gcc-10.0/gcc/cfgexpand.c:6542 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.