This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix PR/14058
- From: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Feb 2004 16:39:23 +0100
- Subject: [patch] Fix PR/14058
Hello,
when compiling the attached testcase (simplified gcc.dg/debug/20020220-1.c)
on powerpc64 with "-m64 -O2 -g" GCC fails with an ICE at var-tracking.c:2390
because parm != REG_EXPR (DECL_INCOMING_RTL (parm)).
They differ because the parm was copied in split_complex_args
but REG_EXPR (DECL_INCOMING_RTL (parm)) was not updated like we do
for REG_EXPR (DECL_RTL (parm)).
The patch updates REG_EXPR (DECL_INCOMING_RTL (parm)) similarly
to REG_EXPR (DECL_RTL (parm)) in all places where DECL_INCOMING_RTL is set
expecpt places where I know it is not necessary (for example DECL_RTL
is set and then copied to DECL_INCOMING_RTL).
Bootstrapped/regtested powerpc64 and x86-64.
Fixed all gcc.dg/debug/20020220-1.c regressions.
OK for mainline ?
Josef
extern int print_screen_max_error (int ok, int xfail);
void
print_complex_max_error (const char *func_name, __complex__ float allowed,
__complex__ int xfail)
{
int ok = 0;
if (print_screen_max_error (ok, xfail))
printf (func_name);
}
2004-02-07 Josef Zlomek <zlomekj@suse.cz>
* emit-rtl.c (set_decl_incoming_rtl): New.
* tree.h (set_decl_incoming_rtl): New.
* function.c (assign_parms): Use set_decl_incoming_rtl for setting
DECL_INCOMING_RTL.
* ada/misc.c (adjust_decl_rtl): Likewise.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/emit-rtl.c,v
retrieving revision 1.376
diff -c -p -c -3 -p -r1.376 emit-rtl.c
*** emit-rtl.c 5 Feb 2004 14:15:35 -0000 1.376
--- emit-rtl.c 9 Feb 2004 15:01:17 -0000
*************** set_decl_rtl (tree t, rtx x)
*** 828,833 ****
--- 828,867 ----
}
}
+ /* Assign the RTX X to parameter declaration T. */
+ void
+ set_decl_incoming_rtl (tree t, rtx x)
+ {
+ DECL_INCOMING_RTL (t) = x;
+
+ if (!x)
+ return;
+ /* For register, we maintain the reverse information too. */
+ if (GET_CODE (x) == REG)
+ REG_ATTRS (x) = get_reg_attrs (t, 0);
+ else if (GET_CODE (x) == SUBREG)
+ REG_ATTRS (SUBREG_REG (x))
+ = get_reg_attrs (t, -SUBREG_BYTE (x));
+ if (GET_CODE (x) == CONCAT)
+ {
+ if (REG_P (XEXP (x, 0)))
+ REG_ATTRS (XEXP (x, 0)) = get_reg_attrs (t, 0);
+ if (REG_P (XEXP (x, 1)))
+ REG_ATTRS (XEXP (x, 1))
+ = get_reg_attrs (t, GET_MODE_UNIT_SIZE (GET_MODE (XEXP (x, 0))));
+ }
+ if (GET_CODE (x) == PARALLEL)
+ {
+ int i;
+ for (i = 0; i < XVECLEN (x, 0); i++)
+ {
+ rtx y = XVECEXP (x, 0, i);
+ if (REG_P (XEXP (y, 0)))
+ REG_ATTRS (XEXP (y, 0)) = get_reg_attrs (t, INTVAL (XEXP (y, 1)));
+ }
+ }
+ }
+
/* Identify REG (which may be a CONCAT) as a user register. */
void
Index: function.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/function.c,v
retrieving revision 1.491
diff -c -p -c -3 -p -r1.491 function.c
*** function.c 8 Feb 2004 02:48:34 -0000 1.491
--- function.c 9 Feb 2004 15:12:14 -0000
*************** assign_parms (tree fndecl)
*** 4645,4651 ****
entry_parm = stack_parm;
/* Record permanently how this parm was passed. */
! DECL_INCOMING_RTL (parm) = entry_parm;
/* If there is actually space on the stack for this parm,
count it in stack_args_size; otherwise set stack_parm to 0
--- 4645,4651 ----
entry_parm = stack_parm;
/* Record permanently how this parm was passed. */
! set_decl_incoming_rtl (parm, entry_parm);
/* If there is actually space on the stack for this parm,
count it in stack_args_size; otherwise set stack_parm to 0
*************** assign_parms (tree fndecl)
*** 4714,4720 ****
&& INTVAL (XEXP (XVECEXP (entry_parm, 0, i), 1)) == 0)
{
entry_parm = XEXP (XVECEXP (entry_parm, 0, i), 0);
! DECL_INCOMING_RTL (parm) = entry_parm;
break;
}
}
--- 4714,4720 ----
&& INTVAL (XEXP (XVECEXP (entry_parm, 0, i), 1)) == 0)
{
entry_parm = XEXP (XVECEXP (entry_parm, 0, i), 0);
! set_decl_incoming_rtl (parm, entry_parm);
break;
}
}
*************** assign_parms (tree fndecl)
*** 5225,5244 ****
{
if (TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE)
{
SET_DECL_RTL (parm,
gen_rtx_CONCAT (DECL_MODE (parm),
DECL_RTL (fnargs),
DECL_RTL (TREE_CHAIN (fnargs))));
! DECL_INCOMING_RTL (parm)
! = gen_rtx_CONCAT (DECL_MODE (parm),
! DECL_INCOMING_RTL (fnargs),
! DECL_INCOMING_RTL (TREE_CHAIN (fnargs)));
fnargs = TREE_CHAIN (fnargs);
}
else
{
SET_DECL_RTL (parm, DECL_RTL (fnargs));
! DECL_INCOMING_RTL (parm) = DECL_INCOMING_RTL (fnargs);
}
fnargs = TREE_CHAIN (fnargs);
}
--- 5225,5246 ----
{
if (TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE)
{
+ rtx tmp;
+
SET_DECL_RTL (parm,
gen_rtx_CONCAT (DECL_MODE (parm),
DECL_RTL (fnargs),
DECL_RTL (TREE_CHAIN (fnargs))));
! tmp = gen_rtx_CONCAT (DECL_MODE (parm),
! DECL_INCOMING_RTL (fnargs),
! DECL_INCOMING_RTL (TREE_CHAIN (fnargs)));
! set_decl_incoming_rtl (parm, tmp);
fnargs = TREE_CHAIN (fnargs);
}
else
{
SET_DECL_RTL (parm, DECL_RTL (fnargs));
! set_decl_incoming_rtl (parm, DECL_INCOMING_RTL (fnargs));
}
fnargs = TREE_CHAIN (fnargs);
}
Index: tree.h
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/tree.h,v
retrieving revision 1.464
diff -c -p -c -3 -p -r1.464 tree.h
*** tree.h 8 Feb 2004 01:59:03 -0000 1.464
--- tree.h 9 Feb 2004 15:03:00 -0000
*************** extern const char *dump_flag_name (enum
*** 3080,3085 ****
--- 3080,3086 ----
/* Assign the RTX to declaration. */
extern void set_decl_rtl (tree, rtx);
+ extern void set_decl_incoming_rtl (tree, rtx);
/* Redefine abort to report an internal error w/o coredump, and
reporting the location of the error in the source file. This logic
Index: ada/misc.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/ada/misc.c,v
retrieving revision 1.76
diff -c -p -c -3 -p -r1.76 misc.c
*** ada/misc.c 6 Feb 2004 11:01:20 -0000 1.76
--- ada/misc.c 9 Feb 2004 15:14:06 -0000
*************** adjust_decl_rtl (tree decl)
*** 774,780 ****
DECL_SIZE (decl) = TYPE_SIZE (new_type);
if (TREE_CODE (decl) == PARM_DECL)
! DECL_INCOMING_RTL (decl) = XEXP (DECL_INCOMING_RTL (decl), 0);
/* If DECL_INITIAL was set, it should be updated to show that
the decl is initialized to the address of that thing.
--- 774,780 ----
DECL_SIZE (decl) = TYPE_SIZE (new_type);
if (TREE_CODE (decl) == PARM_DECL)
! set_decl_incoming_rtl (decl, XEXP (DECL_INCOMING_RTL (decl), 0));
/* If DECL_INITIAL was set, it should be updated to show that
the decl is initialized to the address of that thing.