summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/testsuite/ChangeLog23
-rw-r--r--gcc/testsuite/g++.dg/torture/pr82902.C21
-rw-r--r--gcc/testsuite/gcc.dg/pr82765.c5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82402.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82697.c23
-rw-r--r--gcc/tree-ssa-phiopt.c17
-rw-r--r--gcc/tree-ssa-phiprop.c2
-rw-r--r--gcc/tree-vect-loop-manip.c2
-rw-r--r--gcc/varasm.c7
10 files changed, 141 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b9121c25ba7..d584d5daf91 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,29 @@
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-11-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82402
+ * tree-vect-loop-manip.c (create_lcssa_for_virtual_phi): Properly
+ set SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
+
+ 2017-10-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82697
+ * tree-ssa-phiopt.c (cond_store_replacement): Use alias-set
+ zero for conditional load and unconditional store.
+
+ 2017-11-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/82765
+ * varasm.c (decode_addr_const): Make offset HOST_WIDE_INT.
+ Truncate ARRAY_REF index and element size.
+
+ 2017-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82902
+ * tree-ssa-phiprop.c (propagate_with_phi): Test proper type.
+
2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 858f21891de..28bd46eeeea 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,26 @@
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-11-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82402
+ * gcc.dg/torture/pr82402.c: New testcase.
+
+ 2017-10-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82697
+ * gcc.dg/torture/pr82697.c: New testcase.
+
+ 2017-11-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/82765
+ * gcc.dg/pr82765.c: New testcase.
+
+ 2017-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82902
+ * g++.dg/torture/pr82902.C: New testcase.
+
2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/g++.dg/torture/pr82902.C b/gcc/testsuite/g++.dg/torture/pr82902.C
new file mode 100644
index 00000000000..cc2ce271d4c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr82902.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+typedef struct el_t {
+ el_t *next;
+ int elem[];
+} EL;
+el_t a, c;
+void *b;
+void *fn1() {
+ if (b)
+ return a.elem;
+ return c.elem;
+}
+typedef struct {
+ int x;
+} EV_T;
+EV_T *d;
+void fn2() {
+ EV_T *e = (EV_T *)fn1();
+ d[0] = *e;
+}
diff --git a/gcc/testsuite/gcc.dg/pr82765.c b/gcc/testsuite/gcc.dg/pr82765.c
new file mode 100644
index 00000000000..dde0aeba7ef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82765.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -w" } */
+
+int a[1][1];
+int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
diff --git a/gcc/testsuite/gcc.dg/torture/pr82402.c b/gcc/testsuite/gcc.dg/torture/pr82402.c
new file mode 100644
index 00000000000..cf90d5c6faf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82402.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+typedef int jmp_buf[1];
+
+extern void exit(int) __attribute__((__noreturn__));
+extern int setjmpx(jmp_buf) __attribute__((__returns_twice__));
+
+jmp_buf jbAnagram;
+int a[6];
+int d;
+int b () { exit (1); }
+int c () { b (); }
+int e ()
+{
+ int f = 0;
+ for (; f < 6; f++)
+ a[f] = d;
+ c ();
+ setjmpx (jbAnagram);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82697.c b/gcc/testsuite/gcc.dg/torture/pr82697.c
new file mode 100644
index 00000000000..57da8a264b9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82697.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+__attribute__((noinline,noclone))
+void test(int *pi, long *pl, int f)
+{
+ *pl = 0;
+
+ *pi = 1;
+
+ if (f)
+ *pl = 2;
+}
+
+int main()
+{
+ void *p = __builtin_malloc(sizeof (long));
+
+ test(p, p, 0);
+
+ if (*(int *)p != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 07a226e149c..6dfd69ff6e5 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -1809,9 +1809,24 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
gsi_remove (&gsi, true);
release_defs (assign);
+ /* Make both store and load use alias-set zero as we have to
+ deal with the case of the store being a conditional change
+ of the dynamic type. */
+ lhs = unshare_expr (lhs);
+ tree *basep = &lhs;
+ while (handled_component_p (*basep))
+ basep = &TREE_OPERAND (*basep, 0);
+ if (TREE_CODE (*basep) == MEM_REF
+ || TREE_CODE (*basep) == TARGET_MEM_REF)
+ TREE_OPERAND (*basep, 1)
+ = fold_convert (ptr_type_node, TREE_OPERAND (*basep, 1));
+ else
+ *basep = build2 (MEM_REF, TREE_TYPE (*basep),
+ build_fold_addr_expr (*basep),
+ build_zero_cst (ptr_type_node));
+
/* 2) Insert a load from the memory of the store to the temporary
on the edge which did not contain the store. */
- lhs = unshare_expr (lhs);
name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
new_stmt = gimple_build_assign (name, lhs);
gimple_set_location (new_stmt, locus);
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 095df967e16..63c3c164894 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -354,7 +354,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
/* Found a proper dereference with an aggregate copy. Just
insert aggregate copies on the edges instead. */
- if (!is_gimple_reg_type (TREE_TYPE (TREE_TYPE (ptr))))
+ if (!is_gimple_reg_type (TREE_TYPE (gimple_assign_lhs (use_stmt))))
{
if (!gimple_vdef (use_stmt))
goto next;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index f48336bff58..1269422cb31 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -643,6 +643,8 @@ create_lcssa_for_virtual_phi (struct loop *loop)
gimple *stmt;
use_operand_p use_p;
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_vop)
+ = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vop);
add_phi_arg (new_phi, vop, exit_e, UNKNOWN_LOCATION);
gimple_phi_set_result (new_phi, new_vop);
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, vop)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 05e48a5b894..e240ba77430 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2827,7 +2827,7 @@ static void
decode_addr_const (tree exp, struct addr_const *value)
{
tree target = TREE_OPERAND (exp, 0);
- int offset = 0;
+ HOST_WIDE_INT offset = 0;
rtx x;
while (1)
@@ -2841,8 +2841,9 @@ decode_addr_const (tree exp, struct addr_const *value)
else if (TREE_CODE (target) == ARRAY_REF
|| TREE_CODE (target) == ARRAY_RANGE_REF)
{
- offset += (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (target)))
- * tree_to_shwi (TREE_OPERAND (target, 1)));
+ /* Truncate big offset. */
+ offset += (TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (target)))
+ * TREE_INT_CST_LOW (TREE_OPERAND (target, 1)));
target = TREE_OPERAND (target, 0);
}
else if (TREE_CODE (target) == MEM_REF