https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67639
Bug ID: 67639 Summary: ICE at -O1 and above on x86_64-linux-gnu in expand_gimple_basic_block, at cfgexpand.c:5697 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following (invalid) code causes an ICE when compiled with the current gcc trunk at -O1 and above on x86_64-linux-gnu in the 64-bit mode (but not in 32-bit mode). This is a regression from 5.2.x. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 6.0.0 20150919 (experimental) [trunk revision 227932] (GCC) $ $ gcc-trunk -m64 -O0 -c small.c small.c: In function ‘foo’: small.c:5:17: error: invalid register name for ‘x’ register long x asm ("r2") = p; ^ $ gcc-trunk -m32 -O1 -c small.c small.c: In function ‘foo’: small.c:5:17: error: invalid register name for ‘x’ register long x asm ("r2") = p; ^ $ gcc-5.2 -m64 -O1 -c small.c small.c: In function ‘foo’: small.c:5:17: error: invalid register name for ‘x’ register long x asm ("r2") = p; ^ $ $ gcc-trunk -m64 -O1 -c small.c small.c: In function ‘foo’: small.c:5:17: error: invalid register name for ‘x’ register long x asm ("r2") = p; ^ small.c:2:1: internal compiler error: tree check: expected ssa_name, have var_decl in expand_gimple_basic_block, at cfgexpand.c:5697 foo (int p) ^ 0xd292cc tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc-trunk/gcc/tree.c:9512 0x6f8e36 tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc-trunk/gcc/tree.h:2858 0x6f8e36 expand_gimple_basic_block ../../gcc-trunk/gcc/cfgexpand.c:5697 0x6fdfc6 execute ../../gcc-trunk/gcc/cfgexpand.c:6286 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. $ ----------------------------------------------- void foo (int p) { int t; register long x asm ("r2") = p; __asm ("mov %0, %1;" : "=r" (t), "=r" (t), "=r" (t), "=r" (x) : "0" (x)); }