This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/70115] New: gcc ICE at -O2 (seg fault) and above on valid code on x86_64-linux-gnu
- From: "helloqirun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Mar 2016 09:31:41 +0000
- Subject: [Bug tree-optimization/70115] New: gcc ICE at -O2 (seg fault) and above on valid code on x86_64-linux-gnu
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70115
Bug ID: 70115
Summary: gcc ICE at -O2 (seg fault) and above on valid code on
x86_64-linux-gnu
Product: gcc
Version: 6.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 -O2 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.
It also crashes gcc-5.X and 4.8. But 4.9 and 4.6 work fine.
$ 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/6.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 6.0.0 20160306 (experimental) [trunk revision 234013] (GCC)
$ gcc-trunk -O2 abc.c
abc.c: In function 'main':
abc.c:3:5: internal compiler error: Segmentation fault
int main() {
^~~~
0xb5a3cf crash_signal
../../gcc/gcc/toplev.c:335
0x89d0cb contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3119
0x89d0cb fold_comparison
../../gcc/gcc/fold-const.c:8433
0x8826da fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../gcc/gcc/fold-const.c:11113
0x8a0714 fold(tree_node*)
../../gcc/gcc/fold-const.c:12113
0xcb14b8 simplify_replace_tree
../../gcc/gcc/tree-ssa-loop-niter.c:1798
0xcb315c substitute_in_loop_info(loop*, tree_node*, tree_node*)
../../gcc/gcc/tree-ssa-loop-niter.c:4293
0xb96a17 replace_uses_by(tree_node*, tree_node*)
../../gcc/gcc/tree-cfg.c:1871
0xb97317 gimple_merge_blocks
../../gcc/gcc/tree-cfg.c:1938
0x7589b5 merge_blocks(basic_block_def*, basic_block_def*)
../../gcc/gcc/cfghooks.c:774
0xba0593 cleanup_tree_cfg_bb
../../gcc/gcc/tree-cfgcleanup.c:660
0xba0f56 cleanup_tree_cfg_1
../../gcc/gcc/tree-cfgcleanup.c:726
0xba0f56 cleanup_tree_cfg_noloop
../../gcc/gcc/tree-cfgcleanup.c:761
0xba0f56 cleanup_tree_cfg()
../../gcc/gcc/tree-cfgcleanup.c:812
0xc95459 tree_unroll_loops_completely(bool, bool)
../../gcc/gcc/tree-ssa-loop-ivcanon.c:1369
0xc956d3 execute
../../gcc/gcc/tree-ssa-loop-ivcanon.c:1528
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ cat abc.c
typedef int size_t;
char a;
int main() {
size_t b, c;
for (;;) {
b = 0;
for (; c;)
;
for (; b < sizeof(long); b++)
;
for (; b < c; b++)
a++;
for (; c < b; c++)
;
}
}