1/* PR target/5755
2   This testcase failed because the caller of a function returning struct
3   expected the callee to pop up the hidden return structure pointer,
4   while callee was actually not poping it up (as the hidden argument
5   was passed in register).  */
6/* { dg-do run } */
7/* { dg-options "-O2 -fomit-frame-pointer" } */
8
9extern void abort (void);
10extern void exit (int);
11
12typedef struct {
13   int a1, a2;
14} A;
15
16A a;
17
18A __attribute__ ((regparm (2)))
19foo (int x)
20{
21  return a;
22}
23
24int __attribute__ ((regparm (2)))
25bar (int x)
26{
27  int r = foo(0).a2;
28  return r;
29}
30
31int
32main ()
33{
34  int f;
35  a.a1 = 530;
36  a.a2 = 980;
37  f = bar (0);
38  if (f != 980)
39    abort ();
40  exit (0);
41}
42