On 05/02/2013 11:56 PM, Jakub Jelinek wrote:
On Thu, May 02, 2013 at 10:30:57PM -0600, Jeff Law wrote:
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr57144.c
@@ -0,0 +1,15 @@
+__attribute__ ((noinline))
+foo(int a)
+{
+  int z = a > 0 ? a : -a;
+  long x = z;
+  if (x > 0x100000000)
+    abort ();
+  else
+    exit (0);
+}
+
+main()
+{
+  foo (1);
+}

Just commenting on the testcase, could you please:
1) add return types (void to foo and int to main)
2) use long long instead of long, otherwise the testcase doesn't fail
    without your patch with -m32
3) I'd add LL suffix to the constant too
4) either prototype extern void abort (void); extern void exit (int);
    or use __builtin_{abort,exit}?
Done.  I'll keep this in mind for future tests.


For 1) and 4) we usually add at least C89 testcases now, unless strictly
necessary (testing K&R stuff).  I believe with long long the testcase should
be fine even on say AVR, because C99 says that long long must be at least
64-bit.
Makes sense; my how things change when you go away for a while! ;-)

jeff

Reply via email to