diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-28 17:21:20 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-28 17:21:20 +0000 |
commit | a9fc9109fc2ba4fea83e94f39914133e2c78ab83 (patch) | |
tree | 5bd6914eeae41f162eb223a6dcffc4ac7a49e58d /gcc/testsuite/gcc.c-torture/execute/20050119-2.c | |
parent | 37cf3a785fab7d68255bd091c5292b9cd189bb33 (diff) | |
download | gcc-a9fc9109fc2ba4fea83e94f39914133e2c78ab83.tar.gz |
PR middle-end/19874
* tree-ssa.c (tree_ssa_useless_type_conversion_1): A conversion
between different machine modes is never a "useless" conversion.
* gcc.c-torture/execute/20050119-2.c: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95688 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/20050119-2.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20050119-2.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/20050119-2.c b/gcc/testsuite/gcc.c-torture/execute/20050119-2.c new file mode 100644 index 00000000000..568109cb2c9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050119-2.c @@ -0,0 +1,40 @@ +/* PR middle-end/19874 */ +typedef enum { A, B, C, D } E; + +struct S { + E __attribute__ ((mode (__byte__))) a; + E __attribute__ ((mode (__byte__))) b; + E __attribute__ ((mode (__byte__))) c; + E __attribute__ ((mode (__byte__))) d; +}; + +extern void abort (void); +extern void exit (int); + +E +foo (struct S *s) +{ + if (s->a != s->b) + abort (); + if (s->c != C) + abort (); + return s->d; +} + +int +main (void) +{ + struct S s[2]; + s[0].a = B; + s[0].b = B; + s[0].c = C; + s[0].d = D; + s[1].a = D; + s[1].b = C; + s[1].c = B; + s[1].d = A; + if (foo (s) != D) + abort (); + exit (0); +} + |