diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-26 15:52:16 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-26 15:52:16 +0000 |
commit | 15cb9e217d3a00192bf33fba0c8febc641b3eed0 (patch) | |
tree | 446442664490b2ac4a275eaa87713b54d0ea4d1b /gcc/ada/sem_attr.adb | |
parent | ff47077a9efa01d2ab69d2892c6a3c377ce5462a (diff) | |
download | gcc-15cb9e217d3a00192bf33fba0c8febc641b3eed0.tar.gz |
* sem_attr.adb: Add some ??? comments for previous change
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135949 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 79a6f020feb..768cdf63ee4 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -8089,8 +8089,26 @@ package body Sem_Attr is -- Arr (X .. Y)'address is identical to Arr (X)'address, -- even if the array is packed and the slice itself is not -- addressable. Transform the prefix into an indexed component. + -- Note that the transformation is safe only if we know that - -- the slice is non-null. + -- the slice is non-null. That is because a null slice can have + -- an out of bounds index value. + + -- Right now, gigi blows up if given 'Address on a slice, and + -- this covers up that bug in one case, but the bug is likely + -- still there in the cases not transformed by this code ??? + + -- It's not clear what 'Address *should* return for a null + -- slice with out of bounds indexes, this might be worth an ARG + -- discussion ??? + + -- One approach would be to do a length check unconditionally, + -- and then do the transformation below unconditionally, but + -- analyze with checks off, avoiding the problem of the out of + -- bounds index. This approach would interpret the address of + -- an out of bounds null slice as being the address where the + -- array element would be if there was one, which is probably + -- as reasonable an interpretation as any ??? declare Loc : constant Source_Ptr := Sloc (P); |