This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: PATCH to get_inner_reference for c++/57793
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Biener <richard dot guenther at gmail dot com>
- Date: Wed, 10 Jul 2013 10:24 +0200
- Subject: Re: RFA: PATCH to get_inner_reference for c++/57793
- References: <51DBA771 dot 3060807 at redhat dot com>
> This PR isn't really a C++ issue; it affects C as well, and presumably
> all other languages. A comment a few lines down says
>
> /* Avoid returning a negative bitpos as this may wreak havoc later. */
>
> but we were failing to avoid that in this case.
>
> Tested x86_64-pc-linux-gnu. OK for trunk/4.8?
Don't we want to error out instead of silently accepting this though? You
could call valid_constant_size_p at the beginning of the block for example.
The idea behind the existing trick is that the reference is within the bounds
of the base object, i.e. the global offset (offset<<3 + bitpos) is positive,
but the bitpos part is negative, so we rearrange it into ((offset-c>>3)<<3 +
(bitpos+c)). Here the global offset is negative because it has overflowed so
I'm not sure the rearrangement makes any sense.
--
Eric Botcazou