Hi,
this is a regression on the mainline introduced by my tree-ssa-alias.c change:
2013-04-17 Eric Botcazou <ebotca...@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...
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 <ebotca...@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 <ebotca...@adacore.com>
* gcc.c-torture/execute/pr58570.c: New test.
--
Eric Botcazou
#pragma pack(1)
struct S
{
int f0:15;
int f1:29;
};
int e = 1, i;
static struct S d[6];
int
main (void)
{
if (e)
{
d[i].f0 = 1;
d[i].f1 = 1;
}
if (d[0].f1 != 1)
__builtin_abort ();
return 0;
}
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c (revision 203241)
+++ tree-ssa-alias.c (working copy)
@@ -803,12 +803,13 @@ nonoverlapping_component_refs_of_decl_p
if (type1 != type2 || TREE_CODE (type1) != RECORD_TYPE)
goto may_overlap;
- /* Different fields of the same record type cannot overlap. */
+ /* Different fields of the same record type cannot overlap, unless they
+ are both bitfields and we are at the RTL level. */
if (field1 != field2)
{
component_refs1.release ();
component_refs2.release ();
- return true;
+ return !(DECL_BIT_FIELD (field1) && DECL_BIT_FIELD (field2));
}
}