[PATCH] Testcase for PR optimization/13488

Jakub Jelinek jakub@redhat.com
Fri Apr 2 12:14:00 GMT 2004


Hi!

PR optimization/13488 was fixed by PR optimization/14235 fix, but I think it
never hurts to have more testcases, ok to commit?
What about 3.4?
The testcase fails on 3.3 branch, so maybe we should backport PR 14235 fix.

2004-04-02  Jakub Jelinek  <jakub@redhat.com>

	PR optimization/13488
	* gcc/testsuite/gcc.c-torture/execute/20040402-1.c: New test.

--- gcc/testsuite/gcc.c-torture/execute/20040402-1.c.jj	2004-01-21 17:12:41.000000000 +0100
+++ gcc/testsuite/gcc.c-torture/execute/20040402-1.c	2004-04-02 13:45:11.000000000 +0200
@@ -0,0 +1,62 @@
+/* PR optimization/13488  */
+extern void abort (void);
+extern void exit (int);
+
+#ifdef __i386__
+# define regparm __attribute__((regparm (1)))
+#else
+# define regparm
+#endif
+
+regparm long
+ll2c_1 (int a, long long x)
+{
+  x = (signed char) x;
+  return x;
+}
+
+regparm long
+ll2c_2 (int a, long long x)
+{
+  return (signed char) x;
+}
+
+regparm long
+ll2s_1 (int a, long long x)
+{
+  x = (short) x;
+  return x;
+}
+
+regparm long
+ll2s_2 (int a, long long x)
+{
+  return (short) x;
+}
+
+regparm long
+ll2i_1 (int a, long long x)
+{
+  x = (int) x;
+  return x;
+}
+
+regparm long
+ll2i_2 (int a, long long x)
+{
+  return (int) x;
+}
+
+int
+main (void)
+{
+  long long a;
+  for (a = 0LL; a < 100000000000LL; a += 10000001000LL)
+    {
+      if (ll2c_1 (0, a) != ll2c_2 (0, a)
+	  || ll2s_1 (0, a) != ll2s_2 (0, a)
+	  || ll2i_1 (0, a) != ll2i_2 (0, a))
+	abort ();
+    }
+  exit (0);
+}

	Jakub



More information about the Gcc-patches mailing list