diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2013-10-09 12:59:02 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-10-09 12:59:02 +0000 |
commit | 378f8976f26a17a53c5c306f7277971e8e7a6aa7 (patch) | |
tree | 8fe48efb934d00e67f7202795323adb3f8a915e2 /gcc | |
parent | 0fe04f5c3185fa3a3beb39fb811df019ed41569c (diff) | |
download | gcc-378f8976f26a17a53c5c306f7277971e8e7a6aa7.zip gcc-378f8976f26a17a53c5c306f7277971e8e7a6aa7.tar.gz gcc-378f8976f26a17a53c5c306f7277971e8e7a6aa7.tar.bz2 |
re PR middle-end/58570 (wrong code for bitfields at -O2 and above)
PR middle-end/58570
* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): Return
false if both components are bitfields.
From-SVN: r203315
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr58570.c | 22 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 5 |
4 files changed, 35 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d04904c..f78642a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-10-09 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-09 Alex Velenko <Alex.Velenko@arm.com> * config/aarch64/arm_neon.h (vclz_s8, vclz_s16, vclz_s32) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ece8c0..4de71eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-09 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/pr58570.c: New test. + 2013-10-09 Alex Velenko <Alex.Velenko@arm.com> * gcc.target/aarch64/vclz.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58570.c b/gcc/testsuite/gcc.c-torture/execute/pr58570.c new file mode 100644 index 0000000..6d5116d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58570.c @@ -0,0 +1,22 @@ +#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; +} diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 0d3c15c..4aaa98b 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -803,12 +803,13 @@ nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2) 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. + ??? Bitfields can overlap at RTL level so punt on them. */ if (field1 != field2) { component_refs1.release (); component_refs2.release (); - return true; + return !(DECL_BIT_FIELD (field1) && DECL_BIT_FIELD (field2)); } } |