diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/expr.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr32374.c | 20 |
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 349272b8480..09f25762d19 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-06-19 Uros Bizjak <ubizjak@gmail.com> + + PR middle-end/32374 + * expr.c (store_constructor): Do not clobber non-zeroed memory. + 2007-06-22 Uros Bizjak <ubizjak@gmail.com> PR target/32413 diff --git a/gcc/expr.c b/gcc/expr.c index 3f0caf117d5..0739b0533bc 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5062,7 +5062,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) cleared = 1; } - if (! cleared) + if (REG_P (target) && !cleared) emit_insn (gen_rtx_CLOBBER (VOIDmode, target)); /* Store each element of the constructor into the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 658ac0c2775..d8ae75c76c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-06-22 Uros Bizjak <ubizjak@gmail.com> + + PR middle-end/32374 + * gcc.dg/pr32374.c: New test. + 2007-06-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/32360 diff --git a/gcc/testsuite/gcc.dg/pr32374.c b/gcc/testsuite/gcc.dg/pr32374.c new file mode 100644 index 00000000000..de15d559f5b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr32374.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern int *stderr; + +void f (int *, const char *, ...); + +void g (const char *conf_name) +{ + typedef struct + { + const char *label; + const int value; + } Section; + + const Section sections[2] = { {"", 0}, {"", 1} }; + + f (stderr, "", "", conf_name, 0, sections[0]); + f (stderr, "", "", conf_name, 0, sections[0]); +} |