This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: adjust generation of component addresses
- From: "Douglas B. Rupp" <rupp at gnat dot com>
- To: "Richard Henderson" <rth at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 24 Feb 2002 19:07:09 -0800
- Subject: Re: adjust generation of component addresses
Here is a more detailed explanation of where it goes wrong on VMS:
Without rth patch:
uintp.adb/line 2447
r0/ +2000000000 #Uint_Table_Start is 2_000_000_000
r5/ -2000000000
addq r0,r5,r0 #r0 now contains 0
s8addq r0,0,r0 #8 is the size of a table entry
addl r0,zero,r0 #r0 still contains 0
addq r2,r0,r2 #r2 contains some heap location
stl r7,0(r2) #value gets stored ok
With rth patch
r0/ 2000000000
r5/ -16000000000 # -2000000000 scaled x 8 (size of table entry)
s8addq r0,0,r0 # r0 now contains 16000000000
addl r0,zero,r0 # sign extend big number = garbage
addq r0,r2,r0 # garbage added to heap location
addq r0,r5,r0 # garbage in garbage out
stl r7,0(r0) # access violation
If the addq r0,r5,r0 instruction were moved to
just after the s8addq, it might work.
To summarize, the lower bound of
the uintp array times the size equals 16000000000 which is more than 32 bits,
so that we're getting an overflow.