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

            Bug ID: 61561
           Summary: arm gcc internal error
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: translation
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.zakirov at samsung dot com

Created attachment 32973
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32973&action=edit
Proposed patch

To reproduce the issue do:
1) Configure gcc for arm as traget and x86 as host.
$ ./configure --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=arm-v7a15v5r2-linux-gnueabi
--prefix=/home/mzakirov/proj/gcc_arm_ref/arm-v7a15v5r2
--with-sysroot=/your_arm/sys-root
2) make -j6
3) make install
4) Compile following:
$ cat ex.c
int dummy(int a);

char a;

void mmm (void)
{
  char dyn[ dummy(3) ];
  a = (char)&dyn[0];
}
$ gcc -O3 ex.c -o ex.o 
ex.c: In function ‘mmm’:
ex.c:8:7: warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]
   a = (char)&dyn[0];
       ^
ex.c:9:1: internal compiler error: in check_rtl, at lra.c:1919
 }
 ^
0x8689e5 check_rtl
   
/home/mzakirov/proj/gcc_arm_ref/build.arm.cortex-a15/sources/gcc_1/gcc/lra.c:1919
0x86bde5 lra(_IO_FILE*)
   
/home/mzakirov/proj/gcc_arm_ref/build.arm.cortex-a15/sources/gcc_1/gcc/lra.c:2309
0x82b02e do_reload
   
/home/mzakirov/proj/gcc_arm_ref/build.arm.cortex-a15/sources/gcc_1/gcc/ira.c:5325
0x82b02e execute
   
/home/mzakirov/proj/gcc_arm_ref/build.arm.cortex-a15/sources/gcc_1/gcc/ira.c:5486
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

Analysis showed that the problem in instruction like:
(insn 26 12 18 2 (set (reg:QI 2 r2)
        (reg:QI 13 sp)) ex.c:8 205 {*arm_movqi_insn}
     (nil))
gcc cse propogates sp register to (char/short) cast from a pointer (32 bit
value) and reload phase fails because gcc do not founds applicable template for
loading a byte or word from sp.
Adding correct template to arm.md fixes the issue. See attached patch.

Note: that issue appeared while translating linux kernel for arm.

Reply via email to