https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69899

            Bug ID: 69899
           Summary: gcc ICE on invalid code on x86_64-linux-gnu in
                    "replace_reg"
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

The following invalid code causes an ICE when compiled with the current gcc
trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes.


It crashes gcc from version 4.4.7 to trunk. gcc-4.4.3 seems to be 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 20160221 (experimental) [trunk revision 233594] (GCC)


$ gcc-trunk abc.c
abc.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
 fn1() { asm("" : "=t"(a) : "0u"(0)); }
 ^~~
abc.c: In function 'fn1':
abc.c:2:1: internal compiler error: in replace_reg, at reg-stack.c:687
0xac8c4f replace_reg
        ../../gcc/gcc/reg-stack.c:686
0xaca85b subst_asm_stack_regs
        ../../gcc/gcc/reg-stack.c:2137
0xaccb2d subst_stack_regs
        ../../gcc/gcc/reg-stack.c:2302
0xaccd68 convert_regs_1
        ../../gcc/gcc/reg-stack.c:2951
0xaccd68 convert_regs_2
        ../../gcc/gcc/reg-stack.c:3086
0xacdb8a convert_regs
        ../../gcc/gcc/reg-stack.c:3121
0xacdb8a reg_to_stack
        ../../gcc/gcc/reg-stack.c:3250
0xacdb8a rest_of_handle_stack_regs
        ../../gcc/gcc/reg-stack.c:3305
0xacdb8a execute
        ../../gcc/gcc/reg-stack.c:3336
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
double a;
fn1() { asm("" : "=t"(a) : "0u"(0)); }

Reply via email to