patches/gcc/3.3.1/pr10412-1-test.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     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 +}