This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples] S/390: Fix tree sharing in s390_gimplify_va_args
- From: "Andreas Krebbel" <Andreas dot Krebbel at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 14 Jul 2008 13:30:18 +0200
- Subject: [tuples] S/390: Fix tree sharing in s390_gimplify_va_args
Hello,
the tuples branch currently doesn't bootstrap on S/390. The problem
is a tree sharing bug in s390_gimplify_va_args.
The current code uses the same tree for the INDIRECT_REF args* on two
different LHSs in the following code piece:
...
args->__overflow_arg_area = D.1235;
<D.1225>:
D.1236 = args->__gpr;
D.1237 = D.1236 + 1;
args->__gpr = D.1237;
...
Fixed with the attached patch.
Bootstrapped on s390x.
Ok to apply?
Bye,
-Andreas-
P.S.: I've added the tuples branch to my daily built list.
2008-07-14 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.c: (s390_gimplify_va_arg) Unshare the args* tree.
Index: gcc/config/s390/s390.c
===================================================================
*** gcc/config/s390/s390.c.orig 2008-06-25 17:40:44.000000000 +0200
--- gcc/config/s390/s390.c 2008-07-14 11:27:51.000000000 +0200
*************** s390_gimplify_va_arg (tree valist, tree
*** 8495,8503 ****
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);
size = int_size_in_bytes (type);
if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
--- 8495,8507 ----
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);
sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
+ /* The tree for args* cannot be shared between gpr/fpr and ovf since
+ both appear on a lhs. */
+ valist = unshare_expr (valist);
+ ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
+
size = int_size_in_bytes (type);
if (pass_by_reference (NULL, TYPE_MODE (type), type, false))