> The testcase doesn't necessarily need to FAIL without the patch on x86, it
> is fine if it fails on some PowerPC* or Visium.
Here's what I have installed on mainline and 6 branch (not sure it's worth
fixing on the aging 5 branch). The test fails on PowerPC/Linux:
(gdb) b param-5.c:26
Breakpoint 1 at 0x10000510: file param-5.c, line 26.
(gdb) run
Starting program: /nfs/tron/work/botcazou/gcc-head/powerpc-linux-gnu/param-5
Breakpoint 1, foo (
str=<error reading variable: Cannot access memory at address 0xffffffc8>,
count=0) at param-5.c:26
26 count--; /* BREAK */
(gdb) bt
#0 foo (
str=<error reading variable: Cannot access memory at address 0xffffffc8>,
count=0) at param-5.c:26
#1 0x1000050c in foo (
str=<error reading variable: value has been optimized out>, count=1)
at param-5.c:24
#2 0x10000590 in main () at param-5.c:33
2016-06-22 Eric Botcazou <ebotca...@adacore.com>
* function.c (assign_parm_setup_reg): Prevent sharing in another case.
2016-06-22 Eric Botcazou <ebotca...@adacore.com>
* gcc.dg/guality/param-5.c: New test.
--
Eric Botcazou
Index: function.c
===================================================================
--- function.c (revision 237677)
+++ function.c (working copy)
@@ -3314,6 +3314,8 @@ assign_parm_setup_reg (struct assign_par
set_mem_attributes (parmreg, parm, 1);
}
+ /* We need to preserve an address based on VIRTUAL_STACK_VARS_REGNUM for
+ the debug info in case it is not legitimate. */
if (GET_MODE (parmreg) != GET_MODE (rtl))
{
rtx tempreg = gen_reg_rtx (GET_MODE (rtl));
@@ -3323,7 +3325,8 @@ assign_parm_setup_reg (struct assign_par
all->last_conversion_insn);
emit_move_insn (tempreg, rtl);
tempreg = convert_to_mode (GET_MODE (parmreg), tempreg, unsigned_p);
- emit_move_insn (parmreg, tempreg);
+ emit_move_insn (MEM_P (parmreg) ? copy_rtx (parmreg) : parmreg,
+ tempreg);
all->first_conversion_insn = get_insns ();
all->last_conversion_insn = get_last_insn ();
end_sequence ();
@@ -3331,7 +3334,7 @@ assign_parm_setup_reg (struct assign_par
did_conversion = true;
}
else
- emit_move_insn (parmreg, rtl);
+ emit_move_insn (MEM_P (parmreg) ? copy_rtx (parmreg) : parmreg, rtl);
rtl = parmreg;
/* { dg-do run } */
/* { dg-options "-g" } */
/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
typedef __UINTPTR_TYPE__ uintptr_t;
typedef struct { uintptr_t pa; uintptr_t pb; } fatp_t
__attribute__ ((aligned (2 * __alignof__ (uintptr_t))));
__attribute__((noinline, noclone)) void
clear_stack (void)
{
char a[128 * 1024 + 128];
__builtin_memset (a, 0, sizeof (a));
}
__attribute__((noinline, noclone)) void
foo (fatp_t str, int count)
{
char a[128 * 1024];
if (count > 0)
foo (str, count - 1);
clear_stack ();
count--; /* BREAK */
}
int
main (void)
{
fatp_t ptr = { 31415927, 27182818 };
foo (ptr, 1);
return 0;
}
/* { dg-final { gdb-test 26 "str.pa" "31415927" } } */
/* { dg-final { gdb-test 26 "str.pb" "27182818" } } */