OSDN Git Service

2010-04-20 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Apr 2010 14:18:35 +0000 (14:18 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Apr 2010 14:18:35 +0000 (14:18 +0000)
PR tree-optimization/39417
* g++.dg/torture/pr39417.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158560 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr39417.C [new file with mode: 0644]

index 08619da..ff7904b 100644 (file)
@@ -1,5 +1,10 @@
 2010-04-20  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/39417
+       * g++.dg/torture/pr39417.C: New testcase.
+
+2010-04-20  Richard Guenther  <rguenther@suse.de>
+
        * gcc.dg/ipa/ipa-pta-14.c: New testcase.
 
 2010-04-20  Jakub Jelinek  <jakub@redhat.com>
diff --git a/gcc/testsuite/g++.dg/torture/pr39417.C b/gcc/testsuite/g++.dg/torture/pr39417.C
new file mode 100644 (file)
index 0000000..b7bbb88
--- /dev/null
@@ -0,0 +1,56 @@
+// { dg-do run }
+
+#include <vector>
+
+std::vector <int>
+sequence(int l, int n)
+{
+  std::vector <int> ret;
+  for(int i=n;i<=100;i++)
+    {
+      if(i%2==0)
+       {
+         if(l%i==i/2)
+           {
+             int init =l/i-i/2+1;
+             if(init>=0)
+               {
+                 for(int j=0;j<i;j++)
+                   {
+                     ret.push_back(init);
+                     init ++;
+                   }
+                 break;
+               }
+           }
+       }
+      else
+       {
+         if(l%i==0)
+           {
+             int init =l/i-i/2;
+             if(init>=0)
+               {
+                 for(int j=0;j<i;j++)
+                   {
+                     ret.push_back(init);
+                     init ++;
+                   }
+                 break;
+               }
+           }
+       }
+    }
+  return ret;
+}
+extern "C" void abort (void);
+int main()
+{
+  std::vector<int> res = sequence(18, 2);
+  if (res.size () != 3
+      || res[0] != 5
+      || res[1] != 6
+      || res[2] != 7)
+    abort ();
+  return 0;
+}