This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21135] [4.0/4.1 Regression] &a[-2] ICE at the top level


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]