re PR middle-end/49938 (ICE in interpret_loop_phi, at tree-scalar-evolution.c:1645)
authorRichard Guenther <rguenther@suse.de>
Wed, 3 Aug 2011 11:09:35 +0000 (11:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 3 Aug 2011 11:09:35 +0000 (11:09 +0000)
2011-08-03  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/49938
* tree-scalar-evolution.c (interpret_loop_phi): Gracefully
deal with a POLYNOMIAL_CHREC.

* g++.dg/torture/pr49938.C: New testcase.

From-SVN: r177267

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr49938.C [new file with mode: 0644]
gcc/tree-scalar-evolution.c

index 8f865c6ccf7e5d9b96e9872b62f3356e818bc8fe..6fb94cd448397a9d329a57e75f87f76046f78521 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-03  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49938
+       * tree-scalar-evolution.c (interpret_loop_phi): Gracefully
+       deal with a POLYNOMIAL_CHREC.
+
 2011-08-03  Revital Eres  <revital.eres@linaro.org>
 
        * modulo-sched.c (calculate_stage_count,
index 4c8f25cb9ef5581ddce08a5d4a19016af1e058a6..e16b1a07d5626aa8cbd2642310c8e9bafc6ff323 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-03  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49938
+       * g++.dg/torture/pr49938.C: New testcase.
+
 2011-08-02  Jason Merrill  <jason@redhat.com>
 
        PR c++/43886
diff --git a/gcc/testsuite/g++.dg/torture/pr49938.C b/gcc/testsuite/g++.dg/torture/pr49938.C
new file mode 100644 (file)
index 0000000..91804f4
--- /dev/null
@@ -0,0 +1,48 @@
+#include <vector>
+#include <cstdlib>
+typedef unsigned short uint16;
+
+namespace base {
+    class StringPiece
+      {
+    public:
+       typedef std::size_t size_type;
+       size_type size() const { return length_; }
+       size_type length_;
+      };
+}
+
+namespace net {
+    class DNSSECKeySet
+      {
+       bool CheckSignature (const base::StringPiece& name, const
+                            base::StringPiece& zone, const
+                            base::StringPiece& signature, uint16 rrtype,
+                            const std::vector<base::StringPiece>& rrdatas);
+      };
+}
+
+template <class C> class scoped_array
+{
+public: typedef C element_type;
+       explicit scoped_array(C* p = __null):array_(p) {}
+private:   C* array_;
+};
+
+namespace net {
+    bool DNSSECKeySet::CheckSignature (const base::StringPiece& name,
+                                      const base::StringPiece& zone, const base::StringPiece& signature,
+                                      uint16 rrtype, const std::vector<base::StringPiece>& rrdatas)
+      {
+       unsigned signed_data_len = 0;
+       for (std::vector<base::StringPiece>::const_iterator i =
+            rrdatas.begin();
+            i != rrdatas.end(); i++) {
+           signed_data_len += 2;
+           signed_data_len += i->size();
+       }
+       scoped_array<unsigned char> signed_data(new unsigned
+                                               char[signed_data_len]);
+      }
+}
+
index 00fcd3f359f9fbfeab19b8d1675a8e0dd659e1d3..10aaba4e5b93c472ce8f92af2e02a63101f9cc57 100644 (file)
@@ -1642,8 +1642,8 @@ interpret_loop_phi (struct loop *loop, gimple loop_phi_node)
       else if (TREE_CODE (res) == POLYNOMIAL_CHREC)
        new_init = CHREC_LEFT (res);
       STRIP_USELESS_TYPE_CONVERSION (new_init);
-      gcc_assert (TREE_CODE (new_init) != POLYNOMIAL_CHREC);
-      if (!operand_equal_p (init_cond, new_init, 0))
+      if (TREE_CODE (new_init) == POLYNOMIAL_CHREC
+         || !operand_equal_p (init_cond, new_init, 0))
        return chrec_dont_know;
     }