aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-06-19 07:17:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-06-19 07:17:55 +0000
commitdb9bbdeca441e21f50b12cbfc2ff34992242b4f3 (patch)
tree2dd74aa5ee4c48fb661ebf5776878a3a0c3167a9 /gcc
parent245ad722ca8f9605165f90f9dd3f8e6137e68b38 (diff)
downloadgcc-db9bbdeca441e21f50b12cbfc2ff34992242b4f3.zip
gcc-db9bbdeca441e21f50b12cbfc2ff34992242b4f3.tar.gz
gcc-db9bbdeca441e21f50b12cbfc2ff34992242b4f3.tar.bz2
re PR ipa/81112 (internal compiler error: tree check: expected integer_cst, have range_expr in get_len, at tree.h:5321)
2017-06-19 Richard Biener <rguenther@suse.de> PR ipa/81112 * ipa-prop.c (find_constructor_constant_at_offset): Handle RANGE_EXPR conservatively. * g++.dg/torture/pr81112.C: New testcase. From-SVN: r249357
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-prop.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr81112.C67
4 files changed, 84 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a741d75..60d3155 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-19 Richard Biener <rguenther@suse.de>
+
+ PR ipa/81112
+ * ipa-prop.c (find_constructor_constant_at_offset): Handle
+ RANGE_EXPR conservatively.
+
2017-06-16 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 292f3e2..51f6221 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -3013,7 +3013,10 @@ find_constructor_constant_at_offset (tree constructor, HOST_WIDE_INT req_offset)
if (index)
{
- off = wi::to_offset (index);
+ if (TREE_CODE (index) == RANGE_EXPR)
+ off = wi::to_offset (TREE_OPERAND (index, 0));
+ else
+ off = wi::to_offset (index);
if (TYPE_DOMAIN (type) && TYPE_MIN_VALUE (TYPE_DOMAIN (type)))
{
tree low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
@@ -3022,6 +3025,8 @@ find_constructor_constant_at_offset (tree constructor, HOST_WIDE_INT req_offset)
TYPE_PRECISION (TREE_TYPE (index)));
}
off *= wi::to_offset (unit_size);
+ /* ??? Handle more than just the first index of a
+ RANGE_EXPR. */
}
else
off = wi::to_offset (unit_size) * ix;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 63960eb..3d77462 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-19 Richard Biener <rguenther@suse.de>
+
+ PR ipa/81112
+ * g++.dg/torture/pr81112.C: New testcase.
+
2017-06-18 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/lto/pr69866_0.c: This test needs alias.
diff --git a/gcc/testsuite/g++.dg/torture/pr81112.C b/gcc/testsuite/g++.dg/torture/pr81112.C
new file mode 100644
index 0000000..10e0ebe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr81112.C
@@ -0,0 +1,67 @@
+// { dg-do compile }
+
+class AssertionResult {
+ bool success_;
+};
+
+AssertionResult AssertionSuccess();
+
+template <typename T1>
+AssertionResult EXPECT_EQ(const T1& expected, const T1& actual) {
+ if (expected == actual) {
+ return AssertionSuccess();
+ }
+ return AssertionSuccess();
+}
+
+struct uuid
+{
+ unsigned char data[16];
+};
+
+bool operator== (uuid const& lhs, uuid const& rhs);
+
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef int __v4si __attribute__ ((__vector_size__ (16)));
+typedef char __v16qi __attribute__ ((__vector_size__ (16)));
+typedef long long __m128i_u __attribute__ ((__vector_size__ (16), __may_alias__, __aligned__ (1)));
+
+int foo (__v16qi);
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_loadu_si128 (__m128i_u const *__P)
+{
+ return *__P;
+}
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_cmpeq_epi32 (__m128i __A, __m128i __B)
+{
+ return (__m128i) ((__v4si)__A == (__v4si)__B);
+}
+extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_movemask_epi8 (__m128i __A)
+{
+ return foo ((__v16qi)__A);
+}
+
+
+__m128i load_unaligned_si128(const unsigned char* p)
+{
+ return _mm_loadu_si128(reinterpret_cast< const __m128i* >(p));
+}
+
+inline bool operator== (uuid const& lhs, uuid const& rhs)
+{
+ __m128i mm_left = load_unaligned_si128(lhs.data);
+ __m128i mm_right = load_unaligned_si128(rhs.data);
+
+ __m128i mm_cmp = _mm_cmpeq_epi32(mm_left, mm_right);
+
+ return _mm_movemask_epi8(mm_cmp) == 0xFFFF;
+}
+
+void crash_gcc7()
+{
+ static const uuid u = uuid();
+ EXPECT_EQ(u, u);
+}