diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-11-03 15:21:15 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-11-03 07:21:15 -0800 |
commit | 08330ec2ad5a413f7e88fbb48092dd0d27000850 (patch) | |
tree | 93fded5899e717286d00db6895ac18a4548de59a | |
parent | b88b7ced9b63f5f77b03dcd7fe114a152ac1dbd5 (diff) | |
download | gcc-08330ec2ad5a413f7e88fbb48092dd0d27000850.zip gcc-08330ec2ad5a413f7e88fbb48092dd0d27000850.tar.gz gcc-08330ec2ad5a413f7e88fbb48092dd0d27000850.tar.bz2 |
re PR middle-end/24589 (wrong code with zero sized structs on CONSTRUCTOR)
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/24589
* gimplify.c (gimplify_expr) <case CONSTRUCTOR>: Add the
expressions to a statement list instead of gimplifying them.
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/24589
* gcc.c-torture/execute/zero-struct-2.c: New test.
From-SVN: r106436
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimplify.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c | 20 |
4 files changed, 37 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2e53736..e449baa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-11-03 Andrew Pinski <pinskia@physics.uc.edu> + + PR middle-end/24589 + * gimplify.c (gimplify_expr) <case CONSTRUCTOR>: Add the + expressions to a statement list instead of gimplifying them. + 2005-11-03 Eric Botcazou <ebotcazou@libertysurf.fr> PR rtl-optimization/23585 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b7d891e..52e70bd 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4312,18 +4312,19 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, { unsigned HOST_WIDE_INT ix; constructor_elt *ce; + tree temp = NULL_TREE; for (ix = 0; VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (*expr_p), ix, ce); ix++) if (TREE_SIDE_EFFECTS (ce->value)) - gimplify_expr (&ce->value, pre_p, post_p, - gimple_test_f, fallback); + append_to_statement_list (ce->value, &temp); - *expr_p = NULL_TREE; + *expr_p = temp; + ret = GS_OK; } - - ret = GS_ALL_DONE; + else + ret = GS_ALL_DONE; break; /* The following are special cases that are not handled by the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 82124c6..ffb3ee0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2005-11-03 Andrew Pinski <pinskia@physics.uc.edu> + PR middle-end/24589 + * gcc.c-torture/execute/zero-struct-2.c: New test. + +2005-11-03 Andrew Pinski <pinskia@physics.uc.edu> + PR c++/24582 * g++.dg/init/switch1.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c b/gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c new file mode 100644 index 0000000..ed1d5a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/zero-struct-2.c @@ -0,0 +1,20 @@ +void abort (void); +int ii; +typedef struct {} raw_spinlock_t; +typedef struct { + raw_spinlock_t raw_lock; +} spinlock_t; +raw_spinlock_t one_raw_spinlock (void) +{ + raw_spinlock_t raw_lock; + ii++; + return raw_lock; +} +int main(void) +{ + spinlock_t lock = (spinlock_t) { .raw_lock = one_raw_spinlock() }; + if (ii != 1) + abort (); + return 0; +} + |