Commit 44e60df3 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/84383 (ICE in maybe_diag_stxncpy_trunc)

	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
parent 3eb1eecf
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.
......
/* 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);
}
......@@ -1878,6 +1878,7 @@ maybe_diag_stxncpy_trunc (gimple_stmt_iterator gsi, tree src, tree cnt)
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment