re PR middle-end/66313 (Unsafe factorization of a*b+a*c)
authorRichard Biener <rguenther@suse.de>
Thu, 1 Jun 2017 08:05:24 +0000 (08:05 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 1 Jun 2017 08:05:24 +0000 (08:05 +0000)
commit48932682a54f1a4a97fd8fc026f2d816519fdb7a
tree84cab82818172c6a30cd70ae641506e23050e0b2
parent58cdd35b95418d0112e8c030d50e63df6a3e6a30
re PR middle-end/66313 (Unsafe factorization of a*b+a*c)

2017-06-01  Richard Biener  <rguenther@suse.de>

PR middle-end/66313
* fold-const.c (fold_plusminus_mult_expr): If the factored
factor may be zero use a wrapping type for the inner operation.
* tree-tailcall.c (independent_of_stmt_p): Pass in to_move bitmap
and handle moved defs.
(process_assignment): Properly guard the unary op case.  Return a
tri-state indicating that moving the stmt before the call may allow
to continue.  Pass through to_move.
(find_tail_calls): Handle moving unrelated defs before
the call.

* c-c++-common/ubsan/pr66313.c: New testcase.
* gcc.dg/tree-ssa/loop-15.c: Adjust.

From-SVN: r248771
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/pr66313.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/loop-15.c
gcc/tree-tailcall.c