From eb723fa314a09f6cf8708f8243a436ff9475558c Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Wed, 3 Aug 2011 11:09:35 +0000 Subject: [PATCH] re PR middle-end/49938 (ICE in interpret_loop_phi, at tree-scalar-evolution.c:1645) 2011-08-03 Richard Guenther 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 | 6 ++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/torture/pr49938.C | 48 ++++++++++++++++++++++++++ gcc/tree-scalar-evolution.c | 4 +-- 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr49938.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f865c6ccf7..6fb94cd4483 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-08-03 Richard Guenther + + PR tree-optimization/49938 + * tree-scalar-evolution.c (interpret_loop_phi): Gracefully + deal with a POLYNOMIAL_CHREC. + 2011-08-03 Revital Eres * modulo-sched.c (calculate_stage_count, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c8f25cb9ef..e16b1a07d56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-08-03 Richard Guenther + + PR tree-optimization/49938 + * g++.dg/torture/pr49938.C: New testcase. + 2011-08-02 Jason Merrill 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 index 00000000000..91804f4b0d5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr49938.C @@ -0,0 +1,48 @@ +#include +#include +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& rrdatas); + }; +} + +template 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& rrdatas) + { + unsigned signed_data_len = 0; + for (std::vector::const_iterator i = + rrdatas.begin(); + i != rrdatas.end(); i++) { + signed_data_len += 2; + signed_data_len += i->size(); + } + scoped_array signed_data(new unsigned + char[signed_data_len]); + } +} + diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 00fcd3f359f..10aaba4e5b9 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -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; } -- 2.30.2