summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2002-05-03 13:29:16 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-05-03 13:29:16 -0700
commitf8c1f16acc60ba5e358a8d07c01c9e1dc25fcd40 (patch)
tree09b77992a5ebf2585453730958d8701115be1daa /gcc
parent55802867e527033b922a263d31ef4ae511bbb2c0 (diff)
downloadgcc-f8c1f16acc60ba5e358a8d07c01c9e1dc25fcd40.tar.gz
New.
From-SVN: r53122
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20020503-1.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020503-1.c b/gcc/testsuite/gcc.c-torture/execute/20020503-1.c
new file mode 100644
index 00000000000..6d45ca09af0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20020503-1.c
@@ -0,0 +1,31 @@
+/* PR 6534 */
+/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i)
+ insertted the code at the wrong place corrupting the i<0 test. */
+
+void abort (void);
+static char *
+inttostr (long i, char buf[128])
+{
+ unsigned long ui = i;
+ char *p = buf + 127;
+ *p = '\0';
+ if (i < 0)
+ ui = -ui;
+ do
+ *--p = '0' + ui % 10;
+ while ((ui /= 10) != 0);
+ if (i < 0)
+ *--p = '-';
+ return p;
+}
+
+int
+main ()
+{
+ char buf[128], *p;
+
+ p = inttostr (-1, buf);
+ if (*p != '-')
+ abort ();
+ return 0;
+}