re PR target/38123 (error: incorrect sharing of tree nodes ap->fp_offset = D.2748;)
authorJakub Jelinek <jakub@gcc.gnu.org>
Sat, 15 Nov 2008 16:40:24 +0000 (17:40 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 15 Nov 2008 16:40:24 +0000 (17:40 +0100)
PR target/38123
* config/i386/i386.c (ix86_gimplify_va_arg): Don't share valist between
gpr and other COMPONENT_REFs.

* gcc.c-torture/compile/pr38123.c: New test.

From-SVN: r141889

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr38123.c [new file with mode: 0644]

index 2e34022..ea83a9e 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/38123
+       * config/i386/i386.c (ix86_gimplify_va_arg): Don't share valist between
+       gpr and other COMPONENT_REFs.
+
 2008-11-15  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/38051
index ed18fcc..38da3a4 100644 (file)
@@ -6579,8 +6579,9 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
   f_ovf = TREE_CHAIN (f_fpr);
   f_sav = TREE_CHAIN (f_ovf);
 
+  gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr),
+               build_va_arg_indirect_ref (valist), f_gpr, NULL_TREE);
   valist = build_va_arg_indirect_ref (valist);
-  gpr = build3 (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
   fpr = build3 (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
   ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
   sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
index dac4651..3ff73d2 100644 (file)
@@ -1,5 +1,10 @@
+2008-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/38123
+       * gcc.c-torture/compile/pr38123.c: New test.
+
 2008-11-15  Richard Guenther  <rguenther@suse.de>
-       Jakub Jelinek  <jakub@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/38051
        * gcc.c-torture/execute/pr38051.c: New testcase.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38123.c b/gcc/testsuite/gcc.c-torture/compile/pr38123.c
new file mode 100644 (file)
index 0000000..b36ad11
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/38123 */
+
+#include <stdarg.h>
+
+struct S { int i; double d; };
+
+struct S
+test (char *x, va_list ap)
+{
+  struct S s;
+  s = va_arg (ap, struct S);
+  return s;
+}