This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/80497] New: gcc ICE at -O1 and above on valid code on x86_64-linux-gnu in "tree_to_uhwi"
- From: "helloqirun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Apr 2017 17:32:15 +0000
- Subject: [Bug tree-optimization/80497] New: gcc ICE at -O1 and above on valid code on x86_64-linux-gnu in "tree_to_uhwi"
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80497
Bug ID: 80497
Summary: gcc ICE at -O1 and above on valid code on
x86_64-linux-gnu in "tree_to_uhwi"
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: helloqirun at gmail dot com
Target Milestone: ---
The following valid code causes an ICE when compiled with the current gcc trunk
at -O1 and above on x86_64-linux-gnu in 64-bit mode
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 8.0.0 20170423 (experimental) [trunk revision 247083] (GCC)
$ gcc-trunk -O1 abc.c
abc.c: In function ‘fn1’:
abc.c:5:6: internal compiler error: in tree_to_uhwi, at tree.c:7346
void fn1() {
^~~
0xe336c7 tree_to_uhwi(tree_node const*)
../../gcc/gcc/tree.c:7346
0x12af2ac get_int_range
../../gcc/gcc/gimple-ssa-sprintf.c:956
0x12b039d set_width
../../gcc/gcc/gimple-ssa-sprintf.c:676
0x12b039d parse_directive
../../gcc/gcc/gimple-ssa-sprintf.c:3146
0x12b039d compute_format_length
../../gcc/gcc/gimple-ssa-sprintf.c:3256
0x12b4655 handle_gimple_call
../../gcc/gcc/gimple-ssa-sprintf.c:3688
0x12b5427 execute
../../gcc/gcc/gimple-ssa-sprintf.c:3716
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.
$ cat abc.c
extern char buf[];
#define T(fmt, ...) __builtin_sprintf(buf, fmt, __VA_ARGS__);
const __int128_t sint128_max = (__int128_t)1
<< sizeof sint128_max * __CHAR_BIT__ - 2;
void fn1() {
__int128_t si128 = sint128_max;
T("%*i", si128)
}