This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21135] [4.0/4.1 Regression] &a[-2] ICE at the top level
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 May 2005 17:18:35 -0000
- Subject: [Bug c++/21135] [4.0/4.1 Regression] &a[-2] ICE at the top level
- References: <20050420232738.21135.mrs@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From mmitchel at gcc dot gnu dot org 2005-05-30 17:18 -------
I'm not sure this is really a C++ bug.
The C++ front end provides the same representation to the middle end for
"&a[-2]" as it does for "&a[2]". It would be wrong for the middle end to say
that this expression is not a valid constant initializer, at least on platforms
where it *is* valid.
The difference in the handling of these two expressions is that
get_inner_reference sets the "offset" out-parameter for &a[-2], but not for
a[2]. That's at odds with its documentation, which says that offset is only set
if the offset is not a constant. Furthermore, the out-parameter "bitpos" is
signed, which suggests that negative values should be acceptable.
Changing get_inner_reference to use ssizetype and sbitsizetype throughout fixes
the problems -- but I'm not sure if that's 100% correct.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |kenner at vlsi1 dot ultra
| |dot nyu dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21135