]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
New.
authorRichard Henderson <rth@gcc.gnu.org>
Fri, 3 May 2002 20:29:16 +0000 (13:29 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 3 May 2002 20:29:16 +0000 (13:29 -0700)
From-SVN: r53122

gcc/testsuite/gcc.c-torture/execute/20020503-1.c [new file with mode: 0644]

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 (file)
index 0000000..6d45ca0
--- /dev/null
@@ -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;
+}