https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69213
Bug ID: 69213 Summary: g++ ICE (segfault) at -O1 and above on x86_64-linux-gnu in "add_dependency" 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 code causes an ICE when compiled with the current g++ trunk at -O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-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 20160109 (experimental) [trunk revision 232190] (GCC) $ g++-trunk -c -O3 abc.c abc.c: In function ?void fn1()?: abc.c:2:40: error: invalid 'asm': operand number out of range void fn1() { __asm__("add %w0%w1%w2" :); } ^ abc.c:2:40: error: invalid 'asm': operand number out of range abc.c:2:40: error: invalid 'asm': operand number out of range abc.c: In function ?int main()?: abc.c:3:1: internal compiler error: Segmentation fault main() { ^~~~ 0xd04cdf crash_signal ../../gcc/gcc/toplev.c:334 0xe3c08d add_dependency ../../gcc/gcc/tree-ssa-loop-im.c:419 0xe3c399 determine_max_movement ../../gcc/gcc/tree-ssa-loop-im.c:743 0xe3d833 invariantness_dom_walker::before_dom_children(basic_block_def*) ../../gcc/gcc/tree-ssa-loop-im.c:1080 0x13858e2 dom_walker::walk(basic_block_def*) ../../gcc/gcc/domwalk.c:265 0xe4005f tree_ssa_lim ../../gcc/gcc/tree-ssa-loop-im.c:2518 0xe4005f execute ../../gcc/gcc/tree-ssa-loop-im.c:2572 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.cc int a, b; void fn1() { __asm__("add %w0%w1%w2" :); } main() { for (; a < 0; b++) a = b; }