This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Vartracking: Remove assertion in vt_add_function_parameters
- From: "Andreas Krebbel" <krebbel at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 17 Oct 2008 15:00:01 +0200
- Subject: [PATCH] Vartracking: Remove assertion in vt_add_function_parameters
Hello,
bootstrap of mainline GCC currently fails on s390x due to the
assertion in vt_add_function_parameters.
With the patch for PR37447 reload assigns a fake decl to every
generated spill slot (%sfp) as part of the MEM_ATTRS. This
unfortunately makes vartracking fail due to an assertion in
vt_add_function_parameters trying to assure that the PARM_DECL always
matches the DECL for incoming function args.
Fixed with the attached patch.
s390x still doesn't bootstrap with this but at least it gets a bit
further.
Ok for mainline?
Bye,
-Andreas-
2008-10-17 Andreas Krebbel <krebbel1@de.ibm.com>
* var-tracking.c (vt_add_function_parameters): Just continue
here instead of throwing an assertion.
2008-10-17 Andreas Krebbel <krebbel1@de.ibm.com>
* gcc.dg/20081017-1.c: New testcase.
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c.orig 2008-10-17 14:11:13.000000000 +0200
+++ gcc/var-tracking.c 2008-10-17 14:11:27.000000000 +0200
@@ -3173,7 +3173,11 @@ vt_add_function_parameters (void)
if (!decl)
continue;
- gcc_assert (parm == decl);
+ /* This might fail if reload spilled the parameter to the stack.
+ In that case the DECL entry in the MEM_ATTRS will point to a
+ fake decl (%sfp) shared by all spill slots. */
+ if (decl == parm)
+ continue;
if (!track_loc_p (incoming, parm, offset, false, &mode, &offset))
continue;
Index: gcc/testsuite/gcc.dg/20081017-1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/20081017-1.c 2008-10-17 14:40:04.000000000 +0200
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-g -O1" } */
+
+/* Variable tracking failed in this case since reload spilled 'a' to
+ the stack creating a fake decl for it. */
+
+typedef struct
+{
+ unsigned long low;
+ long high;
+}
+double_int;
+
+double_int double_int_ext (double_int, unsigned);
+
+unsigned char
+fixed_saturate1 (int mode, double_int a, double_int *f, unsigned char sat_p)
+{
+ double_int max, min;
+
+ lshift_double (min.low, min.high, mode, 2 * (8 * 8), &min.high);
+ double_int_ext (min, mode);
+
+ if (double_int_cmp (a, max))
+ {
+ if (sat_p)
+ *f = max;
+ }
+}