New test from PR 17544
authorNick Clifton <nickc@cygnus.com>
Thu, 1 Oct 1998 17:34:45 +0000 (17:34 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Thu, 1 Oct 1998 17:34:45 +0000 (17:34 +0000)
From-SVN: r22719

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

index 6bdca3fd0f5e50d85996d4e97b3eaf4a524c80de..d1ec25752a5caa175811cb34d8668286406198a4 100644 (file)
@@ -1,6 +1,7 @@
 Thu Oct  1 17:15:26 1998  Nick Clifton  <nickc@cygnus.com>
 
-       * compile/981001-1.c (main): New test.
+       * compile/981001-1.c: New test.
+       * execute/981001-1.c: New test.
        
 Wed Aug 26 16:10:00 1997  J"orn Rennecke <amylaar@cygnus.co.uk>
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/981001-1.c b/gcc/testsuite/gcc.c-torture/execute/981001-1.c
new file mode 100644 (file)
index 0000000..da63f47
--- /dev/null
@@ -0,0 +1,38 @@
+#define NG   0x100L
+
+unsigned long flg = 0;
+
+long sub (int n)
+{
+  int a, b ;
+
+  if (n >= 2)
+    {
+      if (n % 2 == 0)
+       {
+         a = sub (n / 2);
+         
+         return (a + 2 * sub (n / 2 - 1)) * a;
+       }
+      else
+       {
+         a = sub (n / 2 + 1);
+         b = sub (n / 2);
+         
+         return a * a + b * b;
+       }
+    }
+  else 
+    return (long) n;
+}
+
+int main (void)
+{
+  if (sub (30) != 832040L)
+    flg |= NG;
+
+  if (flg)
+    abort ();
+  
+  exit (0);
+}