2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020224-1.c
bloba286b6b0599e9365d84b68283b93baae29bb24b9
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 { target i?86-*-* } } */
7 /* { dg-options "-O2 -fomit-frame-pointer" } */
9 extern void abort (void);
10 extern void exit (int);
12 typedef struct {
13 int a1, a2;
14 } A;
16 A a;
18 A __attribute__ ((regparm (2)))
19 foo (int x)
21 return a;
24 int __attribute__ ((regparm (2)))
25 bar (int x)
27 int r = foo(0).a2;
28 return r;
31 int
32 main ()
34 int f;
35 a.a1 = 530;
36 a.a2 = 980;
37 f = bar (0);
38 if (f != 980)
39 abort ();
40 exit (0);