https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61375
Bug ID: 61375 Summary: ICE in int_cst_value at -O3 in tree-ssa pass when compiling a reference to an __int128 value Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gary at intrepid dot com CC: nenad at intrepid dot com Target: x86_64 Created attachment 32880 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32880&action=edit pre-processed "C" source, generates ICE at -O3 in tree-ssa When compiling the attached pre-processed source file at -O3, the following stack trace is generated. $ gcc -O3 -fpreprocessed -c ice-int_cst_value-int128.i ice-int_cst_value-int128.i: In function ‘test15’: ice-int_cst_value-int128.i:442:1: internal compiler error: in int_cst_value, at tree.c:10492 test15 () ^ 0xe3fb99 int_cst_value(tree_node const*) /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree.c:10492 0xd03709 find_bswap_or_nop_1 /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree-ssa-math-opts.c:1848 0xd0354c find_bswap_or_nop_1 /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree-ssa-math-opts.c:1815 0xd0354c find_bswap_or_nop_1 /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree-ssa-math-opts.c:1815 0xd039a9 find_bswap_or_nop_1 /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree-ssa-math-opts.c:1916 0xd03f6a find_bswap_or_nop /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree-ssa-math-opts.c:2034 0xd04ac3 execute /eng/upc/dev/gary/gupc-gcc-trunk/src/gcc/tree-ssa-math-opts.c:2322 The compiler is based on: Last Changed Rev: 211071 Last Changed Date: 2014-05-29 17:17:10 -0700 The test case can likely be reduced. The issue seems to relate to an attempt to simplify an expression that mixes an address and an __int128 value. The ICE triggered here: 10488 unsigned bits = TYPE_PRECISION (TREE_TYPE (x)); 10489 unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x); 10490 10491 /* Make sure the sign-extended value will fit in a HOST_WIDE_INT. */ 10492 gcc_assert (cst_and_fits_in_hwi (x)); where 'x' is: <integer_cst 0x7ffff19ab0e0 type <integer_type 0x7ffff19be690 upcr_pshared_ptr_t> constant 0x0fffff00000000000> and the type is a 128 bit integer: <integer_type 0x7ffff19be690 upcr_pshared_ptr_t sizes-gimplified public unsigned TI size <integer_cst 0x7ffff189d6c0 type <integer_type 0x7ffff189f150 bitsizetype> constant 128> unit size <integer_cst 0x7ffff189d6d8 type <integer_type 0x7ffff189f0a8 sizetype> constant 16> align 128 symtab 0 alias set -1 canonical type 0x7ffff189fb28 precision 128 min <integer_cst 0x7ffff189d9a8 0> max <integer_cst 0x7ffff189c668 0xffffffffffffffffffffffffffffffff> context <translation_unit_decl 0x7ffff19c3b80 D.1942> pointer_to_this <pointer_type 0x7ffff19c97e0>> The gimple statement being simplified looks like this: _15 = array.0_8 & 18446726481523507200 (gdb) p/x 18446726481523507200 $4 = 0xfffff00000000000