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

Reply via email to