diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-02-25 22:49:44 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2002-02-25 22:49:44 +0000 |
commit | 10a6bd526ea8b2309ad3f7fd638547ac5c35ea4d (patch) | |
tree | d42987cab9756c98cd2f97cdd04923a0a5000dc8 /gcc/testsuite | |
parent | 7ff0ea02ccfd170302cd122bdea4f98861d62d1b (diff) |
PR target/5755
* config/i386/i386.c (ix86_return_pops_args): Only pop
fake structure return argument if it was passed on the stack.
* gcc.dg/20020224-1.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@50028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/20020224-1.c | 41 |
2 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8d445c87f25..393aec7b9c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-02-25 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/20020224-1.c: New test. + 2002-02-25 Alan Modra <amodra@bigpond.net.au> * gcc.c-torture/execute/20020225-1.c: New. diff --git a/gcc/testsuite/gcc.dg/20020224-1.c b/gcc/testsuite/gcc.dg/20020224-1.c new file mode 100644 index 00000000000..a286b6b0599 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020224-1.c @@ -0,0 +1,41 @@ +/* PR target/5755 + This testcase failed because the caller of a function returning struct + expected the callee to pop up the hidden return structure pointer, + while callee was actually not poping it up (as the hidden argument + was passed in register). */ +/* { dg-do run { target i?86-*-* } } */ +/* { dg-options "-O2 -fomit-frame-pointer" } */ + +extern void abort (void); +extern void exit (int); + +typedef struct { + int a1, a2; +} A; + +A a; + +A __attribute__ ((regparm (2))) +foo (int x) +{ + return a; +} + +int __attribute__ ((regparm (2))) +bar (int x) +{ + int r = foo(0).a2; + return r; +} + +int +main () +{ + int f; + a.a1 = 530; + a.a2 = 980; + f = bar (0); + if (f != 980) + abort (); + exit (0); +} |