diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-04-01 23:13:29 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-04-01 23:13:29 +0200 |
commit | 19228b93eacef5d8661c5d5a82272d42a82e0e26 (patch) | |
tree | feaee55ecf6450268c89a7644e7055c18ceee503 /gcc/testsuite | |
parent | 88cb339e2fc095381098658177b8600ee151c58f (diff) | |
download | gcc-19228b93eacef5d8661c5d5a82272d42a82e0e26.zip gcc-19228b93eacef5d8661c5d5a82272d42a82e0e26.tar.gz gcc-19228b93eacef5d8661c5d5a82272d42a82e0e26.tar.bz2 |
re PR middle-end/48335 (ICE in convert_move)
PR middle-end/48335
* expr.c (expand_assignment): Handle all possibilities
if TO_RTX is CONCAT.
* expmed.c (store_bit_field_1): Avoid trying to create
invalid SUBREGs.
(store_split_bit_field): If SUBREG_REG (op0) or
op0 itself has smaller mode than word, return it
for offset 0 and const0_rtx for out-of-bounds stores.
If word is const0_rtx, skip it.
* gcc.c-torture/compile/pr48335-1.c: New test.
* gcc.dg/pr48335-1.c: New test.
* gcc.dg/pr48335-2.c: New test.
* gcc.dg/pr48335-3.c: New test.
* gcc.dg/pr48335-4.c: New test.
* gcc.dg/pr48335-5.c: New test.
* gcc.dg/pr48335-6.c: New test.
* gcc.dg/pr48335-7.c: New test.
* gcc.dg/pr48335-8.c: New test.
* gcc.target/i386/pr48335-1.c: New test.
From-SVN: r171855
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr48335-1.c | 41 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-1.c | 48 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-2.c | 58 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-3.c | 48 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-4.c | 39 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-5.c | 38 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-6.c | 46 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-7.c | 38 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48335-8.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr48335-1.c | 32 |
11 files changed, 433 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 62d1fd6..4ffaaac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2011-04-01 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/48335 + * gcc.c-torture/compile/pr48335-1.c: New test. + * gcc.dg/pr48335-1.c: New test. + * gcc.dg/pr48335-2.c: New test. + * gcc.dg/pr48335-3.c: New test. + * gcc.dg/pr48335-4.c: New test. + * gcc.dg/pr48335-5.c: New test. + * gcc.dg/pr48335-6.c: New test. + * gcc.dg/pr48335-7.c: New test. + * gcc.dg/pr48335-8.c: New test. + * gcc.target/i386/pr48335-1.c: New test. + 2011-04-01 Vincent Lefevre <vincent+gcc@vinc17.org> PR c/36299 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c b/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c new file mode 100644 index 0000000..6f81338 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c @@ -0,0 +1,41 @@ +/* PR middle-end/48335 */ + +struct S { float d; }; + +void bar (struct S); + +void +f0 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[0] = x; + s.d *= 7.0; + bar (s); +} + +void +f1 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[1] = x; + s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[2] = x; + s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[3] = x; + s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.dg/pr48335-1.c b/gcc/testsuite/gcc.dg/pr48335-1.c new file mode 100644 index 0000000..7a022ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-1.c @@ -0,0 +1,48 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias)); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +void bar (struct S); + +void +f1 (T x) +{ + struct S s; + *(T *) &s.d = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0f }; + *(char *) &s.d = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0f }; + ((char *) &s.d)[2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f4 (int x, int y) +{ + struct S s = { .d = 0.0f }; + ((char *) &s.d)[y] = x; + __real__ s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.dg/pr48335-2.c b/gcc/testsuite/gcc.dg/pr48335-2.c new file mode 100644 index 0000000..a37c079 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-2.c @@ -0,0 +1,58 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias, aligned (1))); +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +void bar (struct S); + +void +f1 (T x) +{ + struct S s; + *(T *) ((char *) &s.d + 1) = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[0] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[1] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f4 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f5 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[3] = x; + __real__ s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.dg/pr48335-3.c b/gcc/testsuite/gcc.dg/pr48335-3.c new file mode 100644 index 0000000..9041f59 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-3.c @@ -0,0 +1,48 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +void bar (struct S); + +void +f1 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[0] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[1] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f4 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[3] = x; + __real__ s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.dg/pr48335-4.c b/gcc/testsuite/gcc.dg/pr48335-4.c new file mode 100644 index 0000000..98e9e1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-4.c @@ -0,0 +1,39 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +void bar (struct S); + +void +f1 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[-1] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[-2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[5] = x; + __real__ s.d *= 7.0; + bar (s); +} diff --git a/gcc/testsuite/gcc.dg/pr48335-5.c b/gcc/testsuite/gcc.dg/pr48335-5.c new file mode 100644 index 0000000..b189548 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-5.c @@ -0,0 +1,38 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias)); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +int +f1 (struct S x) +{ + struct S s = x; + return *(T *) &s.d; +} + +int +f2 (struct S x) +{ + struct S s = x; + return *(char *) &s.d; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((char *) &s.d)[2]; +} + +int +f4 (struct S x, int y) +{ + struct S s = x; + return ((char *) &s.d)[y]; +} diff --git a/gcc/testsuite/gcc.dg/pr48335-6.c b/gcc/testsuite/gcc.dg/pr48335-6.c new file mode 100644 index 0000000..769130c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-6.c @@ -0,0 +1,46 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias, aligned (1))); +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +T +f1 (struct S x) +{ + struct S s = x; + return *(T *) ((char *) &s.d + 1); +} + +int +f2 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[0]; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[1]; +} + +int +f4 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[2]; +} + +int +f5 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[3]; +} diff --git a/gcc/testsuite/gcc.dg/pr48335-7.c b/gcc/testsuite/gcc.dg/pr48335-7.c new file mode 100644 index 0000000..ddb15ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-7.c @@ -0,0 +1,38 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +int +f1 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[0]; +} + +int +f2 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[1]; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[2]; +} + +int +f4 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[3]; +} diff --git a/gcc/testsuite/gcc.dg/pr48335-8.c b/gcc/testsuite/gcc.dg/pr48335-8.c new file mode 100644 index 0000000..bb06c15 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48335-8.c @@ -0,0 +1,31 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +int +f1 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[-1]; +} + +int +f2 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[-2]; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[5]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr48335-1.c b/gcc/testsuite/gcc.target/i386/pr48335-1.c new file mode 100644 index 0000000..08c5284 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr48335-1.c @@ -0,0 +1,32 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra -msse2" } */ + +#include <emmintrin.h> + +typedef __float128 T __attribute__((may_alias)); + +struct S +{ + _Complex double d __attribute__((aligned (16))); +}; + +void bar (struct S); + +void +f1 (T x) +{ + struct S s; + *(T *) &s.d = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (__m128d x) +{ + struct S s; + _mm_store_pd ((double *) &s.d, x); + __real__ s.d *= 7.0; + bar (s); +} |