]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gcc/gcc-3.3.3/pr10412-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 / pr10412-1-test.patch
1 --- /dev/null   Sat Dec 14 13:56:51 2002
2 +++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10412-1.c  Sun Sep 14 16:15:21 2003
3 @@ -0,0 +1,43 @@
4 +/* PR target/10412
5 + * Reporter: shrinivasa@kpitcummins.com 
6 + * Summary: Renesas SH - Incorrect code generation
7 + * Description:
8 + * When following code is compiled  with
9 + * sh-elf-gcc  -S -mhitachi -m2 -O2 bug1.c
10 + * generates an incorrect code.
11 + *
12 + * Testcase tweaked by dank@kegel.com
13 + * Problem only happens with -mhitachi -m2.  Not sure if I can give those
14 + * options for all sh targets.  They work on sh4, though.
15 + * Not marked as xfail as it's a regression relative to hardhat 2.0 gcc-2.97.
16 +*/
17 +/* { dg-do run } */
18 +/* { dg-options "-O2" } */
19 +int global_val;
20 +
21 +int func0(int x)
22 +{
23 +       global_val += x;
24 +       return (x != 99);
25 +}
26 +
27 +int func1(unsigned long addr)
28 +{
29 +       int err;
30 +
31 +       err = func0(addr);
32 +       if (err)
33 +               return (err);
34 +
35 +       err = func0(addr * 7);  /* address of func0 is lost during multiplication -> probable SIGSEGV */
36 +       return (err);
37 +}
38 +
39 +int main(int argc, char **argv)
40 +{
41 +       global_val = 0;
42 +       global_val += func1(99);
43 +       if (global_val != 99 * 8 + 1)
44 +               abort();
45 +       return 0;
46 +}