1.1 --- a/patches/gcc/3.3.1/pr10392-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,65 +0,0 @@
1.4 ---- /dev/null Sat Dec 14 13:56:51 2002
1.5 -+++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10392-1.c Sun Sep 14 14:28:24 2003
1.6 -@@ -0,0 +1,62 @@
1.7 -+/* PR optimization/10392
1.8 -+ * Reporter: marcus@mc.pp.se
1.9 -+ * Summary: [3.3/3.4 regression] [SH] optimizer generates faulty array indexing
1.10 -+ * Description:
1.11 -+ * The address calculation of an index operation on an array on the stack
1.12 -+ * can _under some conditions_ get messed up completely
1.13 -+ *
1.14 -+ * Testcase tweaked by dank@kegel.com
1.15 -+ * Problem only happens with -O2 -m4, so it should only happen on sh4,
1.16 -+ * but what the heck, let's test other architectures, too.
1.17 -+ * Not marked as xfail since it's a regression.
1.18 -+*/
1.19 -+/* { dg-do run } */
1.20 -+/* { dg-options "-O2" } */
1.21 -+/* { dg-options "-O2 -m4" { target sh4-*-* } } */
1.22 -+const char *dont_optimize_function_away;
1.23 -+
1.24 -+const char *use(const char *str)
1.25 -+{
1.26 -+ dont_optimize_function_away = str;
1.27 -+ if (str[0] != 'v')
1.28 -+ abort();
1.29 -+ if (str[1] < '1' || str[1] > '6')
1.30 -+ abort();
1.31 -+ if (str[2])
1.32 -+ abort();
1.33 -+ return str[2] ? "notused" : "v6";
1.34 -+}
1.35 -+
1.36 -+const char *func(char *a, char *b)
1.37 -+{
1.38 -+ char buf[128];
1.39 -+ unsigned char i;
1.40 -+ const char *result;
1.41 -+
1.42 -+ char *item[] = {
1.43 -+ "v1",
1.44 -+ "v2",
1.45 -+ };
1.46 -+
1.47 -+ buf[0] = 'v';
1.48 -+ buf[1] = '3';
1.49 -+ buf[2] = 0;
1.50 -+
1.51 -+ for (i = 0; i < 2; i++) {
1.52 -+ /* bug is: following line passes wild pointer to use() on sh4 -O2 */
1.53 -+ result = use(item[i]);
1.54 -+
1.55 -+ use(buf);
1.56 -+ use(a);
1.57 -+ use(b);
1.58 -+ result = use(result);
1.59 -+ }
1.60 -+ return result;
1.61 -+}
1.62 -+
1.63 -+int main()
1.64 -+{
1.65 -+ func("v4", "v5");
1.66 -+ return 0;
1.67 -+}
1.68 -+