1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/3.3.3/pr10412-1-test.patch Mon May 28 20:57:40 2007 +0000
1.3 @@ -0,0 +1,46 @@
1.4 +--- /dev/null Sat Dec 14 13:56:51 2002
1.5 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10412-1.c Sun Sep 14 16:15:21 2003
1.6 +@@ -0,0 +1,43 @@
1.7 ++/* PR target/10412
1.8 ++ * Reporter: shrinivasa@kpitcummins.com
1.9 ++ * Summary: Renesas SH - Incorrect code generation
1.10 ++ * Description:
1.11 ++ * When following code is compiled with
1.12 ++ * sh-elf-gcc -S -mhitachi -m2 -O2 bug1.c
1.13 ++ * generates an incorrect code.
1.14 ++ *
1.15 ++ * Testcase tweaked by dank@kegel.com
1.16 ++ * Problem only happens with -mhitachi -m2. Not sure if I can give those
1.17 ++ * options for all sh targets. They work on sh4, though.
1.18 ++ * Not marked as xfail as it's a regression relative to hardhat 2.0 gcc-2.97.
1.19 ++*/
1.20 ++/* { dg-do run } */
1.21 ++/* { dg-options "-O2" } */
1.22 ++int global_val;
1.23 ++
1.24 ++int func0(int x)
1.25 ++{
1.26 ++ global_val += x;
1.27 ++ return (x != 99);
1.28 ++}
1.29 ++
1.30 ++int func1(unsigned long addr)
1.31 ++{
1.32 ++ int err;
1.33 ++
1.34 ++ err = func0(addr);
1.35 ++ if (err)
1.36 ++ return (err);
1.37 ++
1.38 ++ err = func0(addr * 7); /* address of func0 is lost during multiplication -> probable SIGSEGV */
1.39 ++ return (err);
1.40 ++}
1.41 ++
1.42 ++int main(int argc, char **argv)
1.43 ++{
1.44 ++ global_val = 0;
1.45 ++ global_val += func1(99);
1.46 ++ if (global_val != 99 * 8 + 1)
1.47 ++ abort();
1.48 ++ return 0;
1.49 ++}