> Especially if it is -O0 only, I don't see why you think so.  Just dg-skip-if
> it for -O1+ if you believe it is unreliable for some reason, but if you
> look at the parameter value after the prologue, not showing the right value
> at -O0 would be a serious bug everywhere.  Having some GDB testcase also
> doesn't hurt, but having it in GCC testsuite has significant advantages
> over that, most GCC developers don't run GDB testsuite after any changes
> they do.

All right, I've attached a couple of guality testcases (param-1.c for -O0 and 
param-2.c for -O1 -fno-var-tracking-assignments, a param-3.c for bare -O1 will 
require further adjustments in var-tracking.c).  Unfortunately they don't fail 
without the patch e.g. on PowerPC, they are reported as unsupported instead 
because of "Cannot access memory at address" messages from GDB...


        * gcc.dg/guality/param-1.c: New test.
        * gcc.dg/guality/param-2.c: Likewise.


-- 
Eric Botcazou
/* { dg-do run } */
/* { dg-options "-g" } */
/* { dg-skip-if "" { *-*-* }  { "*" } { "-O0" } } */

typedef __UINTPTR_TYPE__ uintptr_t;

__attribute__((noinline, noclone)) int
sub (int a, int b)
{
  return a - b;
}

typedef struct { uintptr_t pa; uintptr_t pb; } fatp_t
  __attribute__ ((aligned (2 * __alignof__ (uintptr_t))));

__attribute__((noinline, noclone)) void
foo (fatp_t str, int a, int b)
{
  int i = sub (a, b);
  if (i == 0)           /* BREAK */
    i = sub (b, a);
}

int
main (void)
{
  fatp_t ptr = { 31415927, 27182818 };
  foo (ptr, 1, 2);
  return 0;
}

/* { dg-final { gdb-test 20 "str.pa" "31415927" } } */
/* { dg-final { gdb-test 20 "str.pb" "27182818" } } */
/* { dg-do run } */
/* { dg-options "-g -fno-var-tracking-assignments" } */
/* { dg-skip-if "" { *-*-* }  { "*" } { "-O0" "-O1" } } */

typedef __UINTPTR_TYPE__ uintptr_t;

__attribute__((noinline, noclone)) int
sub (int a, int b)
{
  return a - b;
}

typedef struct { uintptr_t pa; uintptr_t pb; } fatp_t
  __attribute__ ((aligned (2 * __alignof__ (uintptr_t))));

__attribute__((noinline, noclone)) void
foo (fatp_t str, int a, int b)
{
  int i = sub (a, b);
  if (i == 0)           /* BREAK */
    foo (str, a - 1, b);
}

int
main (void)
{
  fatp_t ptr = { 31415927, 27182818 };
  foo (ptr, 1, 2);
  return 0;
}

/* { dg-final { gdb-test 20 "str.pa" "31415927" } } */
/* { dg-final { gdb-test 20 "str.pb" "27182818" } } */

Reply via email to