[Bug ada/20797] New: Code gen creating out-of-bounds addresses on legit code
nick at sqrt dot co dot uk
gcc-bugzilla@gcc.gnu.org
Wed Apr 6 15:36:00 GMT 2005
Looking at GCC 4.0 20050318, and configuring as a cross-compiler for ARM/Linux
thusly:
$ mkdir arm-linux ; cd arm-linux
$ ../configure --prefix=/opt/gcc-linux --target=arm-linux-elf
--enable-languages=c,ada
Once the gnat1 binary is built, just type this from the gcc/ada directory.
$ ../../arm-linux/gcc/gnat1 nlists.adb -O2 -o nlists.s -gnatpg
Turning off optimisation makes no difference to the resulting problem.
The compiled version of Nlists::First() results in:
nlists__first:
@ args = 0, pretend = 0, frame = 0, outgoing = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
cmp r0, #0
ldrne r2, .L320
mov r1, #1191182336
ldrne r3, [r2, #0]
add ip, r0, r0, asl #1
add r1, r1, #8781824
add r1, r1, #35840
addne r3, r3, ip, asl #2
ldrne r0, [r3, r1]
@ lr needed for prologue
bx lr
.L320:
.word nlists__lists__tableX
The problem I see is an out-of-bounds memory access here:
ldrne r0, [r3, r1]
FYI, on my machine:
R1 == 0x47868c00
R3 == 0xb97d3a9c
Here, R3 points to a legitimate memory address
Surely R1 is a little large ?
--
Summary: Code gen creating out-of-bounds addresses on legit code
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nick at sqrt dot co dot uk
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-linux-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20797
More information about the Gcc-bugs
mailing list