This is the mail archive of the gcc-patches@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]

Re: [patch] Fix PR middle-end/58570


On Tue, Oct 8, 2013 at 10:19 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is a regression on the mainline introduced by my tree-ssa-alias.c change:
>
> 2013-04-17  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.
>         (decl_refs_may_alias_p): Add REF1 and REF2 parameters.
>         Use nonoverlapping_component_refs_of_decl_p to disambiguate component
>         references.
>         (refs_may_alias_p_1): Adjust call to decl_refs_may_alias_p.
>         * tree-streamer.c (record_common_node): Adjust reference in comment.
>
> Unlike its model nonoverlapping_component_refs_p from alias.c, the predicate
> nonoverlapping_component_refs_of_decl_p considers that different fields in the
> same structure cannot overlap.  While that's true in GIMPLE, that's false in
> RTL for bitfields and tree-ssa-alias.c is also queried from RTL nowadays...

Probably because the actual accesses may overlap if we choose to
perform a bigger access.

The same can happen if we for struct { char c1; char c2; } perform
an HImode access in case the target doesn't support QImode accesses.
Basically anytime we go through the bitfield expansion path.  Thus, doesn't
that mean that MEM_EXPR is wrong on the MEMs?  Maybe we used to
strip all DECL_BIT_FIELD component-refs at some point (adjusting
MEM_OFFSET accordingly)?

Your patch seems to paper over this issue in the wrong place ...

Richard.

> Therefore the attached patch just copies the missing bits from the former to
> the latter.  Tested on x86_64-suse-linux, OK for the mainline?
>
>
> 2013-10-08  Eric Botcazou  <ebotcazou@adacore.com>
>
>         PR middle-end/58570
>         * tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): Return
>         false if both components are bitfields.
>
>
> 2013-10-08  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gcc.c-torture/execute/pr58570.c: New test.
>
>
> --
> Eric Botcazou


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