This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/51994] [4.6/4.7 Regression] git-1.7.8.3 miscompiled due to negative bitpos from get_inner_reference
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 02 Feb 2012 08:56:04 +0000
- Subject: [Bug middle-end/51994] [4.6/4.7 Regression] git-1.7.8.3 miscompiled due to negative bitpos from get_inner_reference
- Auto-submitted: auto-generated
- References: <bug-51994-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51994
--- Comment #34 from rguenther at suse dot de <rguenther at suse dot de> 2012-02-02 08:56:04 UTC ---
On Wed, 1 Feb 2012, ebotcazou at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51994
>
> --- Comment #32 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-02-01 16:34:30 UTC ---
> > The base object can be an indirect reference, so yes, there doesn't have
> > to be an overall positive offset (well, yes, to the _real_ object,
> > but we don't see that).
>
> If this is an indirect reference, there is no base object by definition. So
> I'm not sure we should care in get_inner_reference and, in any case, I'm not
> sure what to do. Probably avoid sending MEM_REF to get_inner_reference in this
> case,
> after all it's clearly not a handled_component_p-like thing.
Well, you can have component refs wrapped around a MEM_REF (or formerly
an INDIRECT_REF). The only difference now is that the MEM_REF may
have a (negative) constant offset embedded. Now, only if the MEM_REF
is based on an ADDR_EXPR (and thus a real object) we factor in its
(possibly negative) offset to bitpos. So, hum - now I don't see
as easily that we can get a negative bitpos from a not
undefined input ... (maybe except for the Ada fat pointer case).
So your patch is probably ok (can you try verifying we don't get
(too much) codegen differences on a bootstrap?)
Richard.