tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gcc 4.1.3 (netbsd-5-1) ARM compiler bug



On 05/11/11 23:14, Ignatios Souvatzis wrote:
> 
> On Sat, Nov 05, 2011 at 11:40:37PM +0100, Ignatios Souvatzis wrote:
>> Addition: xjpg_dec.c compiles to slow, working code with -O0.
> 
> Isolated test case shows same behaviour:
> marie pointerdiff !% cat pointerdiff.c
> struct foo {
>         char c[1024];
>         char *a;
>         char *b;
> };
> int bar (struct foo *g) {
>         return g->b - g->a;
> }
> marie pointerdiff !% cc -O2 -S pointerdiff.c
> marie pointerdiff !% cat pointerdiff.s
>         .file   "pointerdiff.c"
>         .text
>         .align  2
>         .global bar
>         .type   bar, %function
> bar:
>         @ args = 0, pretend = 0, frame = 0
>         @ frame_needed = 0, uses_anonymous_args = 0
>         @ link register save eliminated.
>         ldr     r0, [r0, #1028]
>         ldr     r3, [r0, #1024]
>         sub     r0, r3, r0
>         @ lr needed for prologue
>         mov     pc, lr
>         .size   bar, .-bar
>         .ident  "GCC: (GNU) 4.1.3 20080704 prerelease (NetBSD nb2 20081120)"
> 
> Regards,
>       -is
> 

Looks to be still present in 4.3 and 4.4, but is fixed on GCC trunk
(don't have a build of 4.5 or 4.6 to hand).

A quick, safe, fix, with probably negligible overhead, is to comment out
the pattern "*arith_adjacentmem" in arm.md.

R.




Home | Main Index | Thread Index | Old Index