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

            Bug ID: 70370
           Summary: ICE in execute_todo, at passes.c:2003 when using
                    __real__ or __imag__ as lvalue in asm
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: clyon at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Created attachment 38065
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38065&action=edit
testcase

The attached test case causes:
fam-asm.c: In function 'fcs':
fam-asm.c:24:1: internal compiler error: in execute_todo, at passes.c:2003
 }
 ^
0xc99467 execute_todo
       
/home/christophe.lyon/src/GCC/sources/gcc-fsf/trunk-for-crontab/gcc/passes.c:2003

When compiled with -S -O2 with aarch64-none-linux-gnu-gcc.

Note that the asm statement writes a Complex, using __real__ and __imag__ as
lvalues.

Modifying the testcase avoids the crash:
- adding declarations:
  float* p_ri = &(__imag__ r);
  float* p_rr = &(__real__ r);
- changing the asm such that it writes to:
[rr] "=w" (*p_rr), [ri] "=w" (*p_ri)
instead of:
[rr] "=w" (__real__ r), [ri] "=w" (__imag__ r)

Reply via email to