+2017-11-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/83128
+ * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Handle STRING_CSTs.
+ (vn_reference_lookup_3): Likewise.
+
2017-11-24 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/83014
+2017-11-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/83128
+ * gcc.dg/tree-ssa/ssa-fre-62.c: New testcase.
+
2017-11-24 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/83014
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-fre1" } */
+
+char f()
+{
+ char *i = (char*)__builtin_malloc(100);
+ __builtin_memcpy(i, "a", 1);
+ return i[0];
+}
+
+/* { dg-final { scan-tree-dump "return 97;" "fre1" } } */
else if (base->opcode == MEM_REF
&& base[1].opcode == ADDR_EXPR
&& (TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == VAR_DECL
- || TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == CONST_DECL))
+ || TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == CONST_DECL
+ || TREE_CODE (TREE_OPERAND (base[1].op0, 0)) == STRING_CST))
{
decl = TREE_OPERAND (base[1].op0, 0);
- ctor = ctor_for_folding (decl);
+ if (TREE_CODE (decl) == STRING_CST)
+ ctor = decl;
+ else
+ ctor = ctor_for_folding (decl);
}
if (ctor == NULL_TREE)
return build_zero_cst (ref->type);
rhs = TREE_OPERAND (tem, 0);
rhs_offset += tree_to_uhwi (TREE_OPERAND (tem, 1));
}
- else if (DECL_P (tem))
+ else if (DECL_P (tem)
+ || TREE_CODE (tem) == STRING_CST)
rhs = build_fold_addr_expr (tem);
else
return (void *)-1;