[parisc-linux] testcase for hppa64 gcc bug

Alan Modra alan@linuxcare.com.au
Fri, 27 Oct 2000 00:43:42 +1100 (EST)


Here is a distilled testcase for the hppa64 bug reported in
http://gcc.gnu.org/ml/gcc-bugs/2000-10/msg00511.html

extern void abort(void);

char p;

int f1 (char **);
int f2 (char *, char **);

char *f3 (char *a, char *b)
{
  char *c = 0;

  if (f1 (&b) != 0)
    goto out;

  /* hppa64 passes bogus value for b */
  f2 (b, &c);

out:
  return c;
}

int f1 (char **x)
{
  if (*x != &p)
    abort ();
  return 0;
}

int f2 (char *a, char **b)
{
  if (a != &p)
    abort ();
  *b += 1;
  return 0;
}

int main (void)
{
  if (f3 (0, &p) != (char *) 0 + 1)
    abort ();
  return 0;
}

-- 
Linuxcare.  Support for the Revolution.