]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gcc/gcc-3.3.3/pr11736-1-test.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gcc / gcc-3.3.3 / pr11736-1-test.patch
1 --- /dev/null   Sat Dec 14 13:56:51 2002
2 +++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11736-1.c  Sun Sep 14 14:26:33 2003
3 @@ -0,0 +1,45 @@
4 +/* PR optimization/11736
5 + * Reporter: marcus@mc.pp.se
6 + * Summary:  Stackpointer messed up on SuperH
7 + * Keywords: wrong-code
8 + * Description:
9 + * When a function with 5 arguments is called in both branches of a
10 + * conditional, and only the last argument differs, the code to push that
11 + * last argument on the stack gets confused. 
12 + * Space for the fifth argument is reserved on the stack by the
13 + * instruction I have marked as "A".  However, if the else-branch is
14 + * taken the stackpointer is decremented _again_ at "B".  This
15 + * decrementation is never restored, and it is only due to the
16 + * restoration of r15 from r14 that the function works at all.  With
17 + * -fomit-frame-pointer it will crash.
18 + *
19 + * Testcase tweaked by dank@kegel.com
20 + * Not marked as xfail since it's a regression from hardhat 2.0 gcc-2.97 
21 + * and dodes gcc-3.0.2
22 + */
23 +
24 +/* { dg-do run } */
25 +/* { dg-options "-O1 -fomit-frame-pointer" } */
26 +
27 +int expected_e;
28 +
29 +void bar(int a, int b, int c, int d, int e)
30 +{
31 +       if (e != expected_e)
32 +               abort();
33 +}
34 +
35 +void foo(int a)
36 +{
37 +       if (a)
38 +               bar(0, 0, 0, 0, 1);
39 +       else
40 +               bar(0, 0, 0, 0, 0);     /* stack pointer decremented extra time here, causing segfault */
41 +}
42 +
43 +int main(int argc, char **argv)
44 +{
45 +       for (expected_e = 0; expected_e < 2; expected_e++)
46 +               foo(expected_e);
47 +       return 0;
48 +}