Port-arm archive

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

GCC 4.1.2 for ARM (in NetBSD 4) produces buggy code with -fno-strict-aliasing?

Hi NetBSD ARMers,

I spent some time tracking down a panic for NetBSD/hpcarm 4.0 on a
Jornada 728, and I guess it is wise to share the result with this list.
Maybe this is already a well-known problem; I don't know.

The panic was triggered when I started using a wireless NIC. The crash
was in wi.o, and looking at the disassembly showed that GCC had produced
buggy code (it uses the wrong base register for loading a value).

c00d4018:       e51b00d0        ldr     r0, [fp, #-208]
c00d401c:       e51b10d0        ldr     r1, [fp, #-208]
c00d4020:       e5900eb4        ldr     r0, [r0, #3764]
c00d4024:       e5903eb8        ldr     r3, [r0, #3768]

The fourth line should not load using r0 as a base, but using r1.

By manually compiling wi.o and removing optimization options from the
command line, I noticed that removing -fno-strict-aliasing causes the
buggy code to be replaced with more reasonable code:


My guess is that all NetBSD ARM platforms which use this version of GCC
could be affected.


Home | Main Index | Thread Index | Old Index