patches/gcc/3.3.1/pr11736-1-test.patch
changeset 330 447b203edc2e
parent 329 419d959441ed
child 331 0c05f9ea3254
     1.1 --- a/patches/gcc/3.3.1/pr11736-1-test.patch	Tue Aug 14 19:32:22 2007 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,48 +0,0 @@
     1.4 ---- /dev/null	Sat Dec 14 13:56:51 2002
     1.5 -+++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11736-1.c	Sun Sep 14 14:26:33 2003
     1.6 -@@ -0,0 +1,45 @@
     1.7 -+/* PR optimization/11736
     1.8 -+ * Reporter: marcus@mc.pp.se
     1.9 -+ * Summary:  Stackpointer messed up on SuperH
    1.10 -+ * Keywords: wrong-code
    1.11 -+ * Description:
    1.12 -+ * When a function with 5 arguments is called in both branches of a
    1.13 -+ * conditional, and only the last argument differs, the code to push that
    1.14 -+ * last argument on the stack gets confused. 
    1.15 -+ * Space for the fifth argument is reserved on the stack by the
    1.16 -+ * instruction I have marked as "A".  However, if the else-branch is
    1.17 -+ * taken the stackpointer is decremented _again_ at "B".  This
    1.18 -+ * decrementation is never restored, and it is only due to the
    1.19 -+ * restoration of r15 from r14 that the function works at all.  With
    1.20 -+ * -fomit-frame-pointer it will crash.
    1.21 -+ *
    1.22 -+ * Testcase tweaked by dank@kegel.com
    1.23 -+ * Not marked as xfail since it's a regression from hardhat 2.0 gcc-2.97 
    1.24 -+ * and dodes gcc-3.0.2
    1.25 -+ */
    1.26 -+
    1.27 -+/* { dg-do run } */
    1.28 -+/* { dg-options "-O1 -fomit-frame-pointer" } */
    1.29 -+
    1.30 -+int expected_e;
    1.31 -+
    1.32 -+void bar(int a, int b, int c, int d, int e)
    1.33 -+{
    1.34 -+	if (e != expected_e)
    1.35 -+		abort();
    1.36 -+}
    1.37 -+
    1.38 -+void foo(int a)
    1.39 -+{
    1.40 -+	if (a)
    1.41 -+		bar(0, 0, 0, 0, 1);
    1.42 -+	else
    1.43 -+		bar(0, 0, 0, 0, 0);	/* stack pointer decremented extra time here, causing segfault */
    1.44 -+}
    1.45 -+
    1.46 -+int main(int argc, char **argv)
    1.47 -+{
    1.48 -+	for (expected_e = 0; expected_e < 2; expected_e++)
    1.49 -+		foo(expected_e);
    1.50 -+	return 0;
    1.51 -+}