This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, middle-end]: Fix PR middle-end/32374
- From: "Uros Bizjak" <ubizjak at gmail dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: "Rask Ingemann Lambertsen" <rask at sygehus dot dk>
- Date: Tue, 19 Jun 2007 13:43:42 +0200
- Subject: [PATCH, middle-end]: Fix PR middle-end/32374
Hello!
As analysed and described in Comment #5 of PR32374, clobber-only insns like
(insn 6 5 7 pr32374.c:13 (clobber (mem/s/c:BLK (plus:DI (reg/f:DI 54
virtual-stack-vars)
(const_int -16 [0xfffffffffffffff0])) [5 A128])) -1 (nil))
are ignored by vregs pass, and this insn further confuses init_regs df
pass into trying to initialize virtual-stack-vars pseudo register.
A clobber is not needed for a memory, as in the next insn we write
something to this address. As pointed out by Rask [1], this clobber is
needed in case of subregs of pseudo registers, wider than
BITS_PER_WORD.
Patch was bootstrapped and regression tested on i686-pc-linux-gnu for
all default languages. OK for mainline?
2007-06-19 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/PR32374
* expr.c (store_constructor): Do not clobber non-zeroed memory.
testsuite/ChangeLog:
2007-06-19 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/PR32374
* gcc.dg/opt/pr32374.c: New test.
[1] http://gcc.gnu.org/ml/gcc/2007-06/msg00669.html
Uros.
Index: testsuite/gcc.dg/pr32374.c
===================================================================
--- testsuite/gcc.dg/pr32374.c (revision 0)
+++ testsuite/gcc.dg/pr32374.c (revision 0)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef long unsigned int size_t;
+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]);
+}
+
Index: expr.c
===================================================================
--- expr.c (revision 125846)
+++ expr.c (working copy)
@@ -5062,7 +5062,7 @@ store_constructor (tree exp, rtx target,
cleared = 1;
}
- if (! cleared)
+ if (REG_P (target) && (! cleared))
emit_insn (gen_rtx_CLOBBER (VOIDmode, target));
/* Store each element of the constructor into the