+2017-02-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/79731
+ * fold-const.c (decode_field_reference): Reject out-of-bound
+ accesses.
+
2017-02-28 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c: Include intl.h.
punsignedp, preversep, pvolatilep);
if ((inner == exp && and_mask == 0)
|| *pbitsize < 0 || offset != 0
- || TREE_CODE (inner) == PLACEHOLDER_EXPR)
+ || TREE_CODE (inner) == PLACEHOLDER_EXPR
+ /* Reject out-of-bound accesses (PR79731). */
+ || (! AGGREGATE_TYPE_P (TREE_TYPE (inner))
+ && compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)),
+ *pbitpos + *pbitsize) < 0))
return 0;
*exp_ = exp;
+2017-02-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/79731
+ * c-c++-common/torture/pr79731.c: New testcase.
+
2017-02-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79732
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-Wno-psabi -w" } */
+
+typedef unsigned V __attribute__ ((vector_size (8)));
+V
+foo (unsigned x, V v)
+{
+ do {
+ v %= x;
+ x = 1;
+ } while (v[1]);
+ return v;
+}
+void fn2 ()
+{
+ V x = foo (5, (V) { 0, 1 });
+ if (x[0] || x[1] || x[2] || x[3]);
+}