https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127393
Bug ID: 127393
Summary: [17 Regression] ICE: in gen_highpart, at
emit-rtl.cc:1673 at -O2
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: aarch64-unknown-linux-gnu
Created attachment 65587
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65587&action=edit
reduced testcase
Compiler output:
$ aarch64-unknown-linux-gnu-gcc -O2 tc.c
during RTL pass: expand
tc.c: In function 'foo':
tc.c:13:7: internal compiler error: in gen_highpart, at emit-rtl.cc:1673
13 | if (__builtin_sub_overflow(0, u.a, &i))
| ^~~~~~~~~~~~~~~~~~~~~~
0x2a78c4d internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0xc63359 fancy_abort(char const*, int, char const*)
/repo/gcc-trunk/gcc/diagnostics/context.cc:1813
0x8865b9 gen_highpart(machine_mode, rtx_def*)
/repo/gcc-trunk/gcc/emit-rtl.cc:1673
0x23807b6 gen_negvti3(rtx_def*, rtx_def*, rtx_def*)
/repo/gcc-trunk/gcc/config/aarch64/aarch64.md:3766
0x13045d8 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
/repo/gcc-trunk/gcc/optabs.cc:8682
0x11399ad expand_neg_overflow
/repo/gcc-trunk/gcc/internal-fn.cc:1660
0x1147d48 expand_arith_overflow
/repo/gcc-trunk/gcc/internal-fn.cc:2912
0xe54f8f expand_call_stmt
/repo/gcc-trunk/gcc/cfgexpand.cc:3147
0xe54f8f expand_gimple_stmt_1
/repo/gcc-trunk/gcc/cfgexpand.cc:4280
0xe54f8f expand_gimple_stmt
/repo/gcc-trunk/gcc/cfgexpand.cc:4427
0xe568b7 expand_gimple_basic_block
/repo/gcc-trunk/gcc/cfgexpand.cc:6544
0xe58d67 execute
/repo/gcc-trunk/gcc/cfgexpand.cc:7295
/repo/gcc-trunk/binary-trunk-20260914200031-r17-4236-gb0730e1d39f95e-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/17.0.0/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-20260914200031-r17-4236-gb0730e1d39f95e-checking-yes-rtl-df-extra-aarch64/bin/../lib/gcc/aarch64-unknown-linux-gnu/17.0.0/
tc.c -quiet -dumpdir a- -dumpbase tc.c -dumpbase-ext .c -mlittle-endian
-mabi=lp64 -O2 -o /tmp/ccZaxsXr.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ aarch64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20260914200031-r17-4236-gb0730e1d39f95e-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/17.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-sysroot=/usr/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu
--with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld
--with-as=/usr/bin/aarch64-unknown-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20260914200031-r17-4236-gb0730e1d39f95e-checking-yes-rtl-df-extra-aarch64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260914 (experimental) (GCC)