PR tree-optimization/84383
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Don't look at
dstoff nor call operand_equal_p if dstbase is NULL.
* gcc.c-torture/compile/pr84383.c: New test.
From-SVN: r257684
2018-02-15 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/84383
+ * tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Don't look at
+ dstoff nor call operand_equal_p if dstbase is NULL.
+
PR tree-optimization/84334
* match.pd ((A +- CST1) +- CST2 -> A + CST3): If A is
also a CONSTANT_CLASS_P, punt.
2018-02-15 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/84383
+ * gcc.c-torture/compile/pr84383.c: New test.
+
PR tree-optimization/84334
* gcc.dg/pr84334.c: New test.
--- /dev/null
+/* PR tree-optimization/84383 */
+
+struct S { char *s; };
+void bar (struct S *);
+
+void
+foo (int a, char *b)
+{
+ struct S c[4];
+ bar (c);
+ __builtin_strncpy (c[a].s, b, 32);
+ c[a].s[31] = '\0';
+ bar (c);
+}
poly_int64 lhsoff;
tree lhsbase = get_addr_base_and_unit_offset (lhs, &lhsoff);
if (lhsbase
+ && dstbase
&& known_eq (dstoff, lhsoff)
&& operand_equal_p (dstbase, lhsbase, 0))
return false;