[PR68083] don't introduce undefined behavior in ifcombine
authorAlexandre Oliva <aoliva@redhat.com>
Tue, 3 Nov 2015 00:30:07 +0000 (00:30 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Tue, 3 Nov 2015 00:30:07 +0000 (00:30 +0000)
commit828ca3d835ac006cbcb2e5b480c6429cc8a75bdd
tree97886b9d02ac0ccd0177983b325624a1c00e5f03
parentdac7e9b81974a69fc437d5115ebb46de11da14de
[PR68083] don't introduce undefined behavior in ifcombine

The ifcombine pass may move a conditional access to an uninitialized
value before the condition that ensures it is always well-defined,
thus introducing undefined behavior.  Stop it from doing so.

for  gcc/ChangeLog

PR tree-optimization/68083
* tree-ssa-ifcombine.c: Include tree-ssa.h.
(bb_no_side_effects_p): Test for undefined uses too.
* tree-ssa.c (gimple_uses_undefined_value_p): New.
* tree-ssa.h (gimple_uses_undefined_value_p): Declare.

for  gcc/testsuite/ChangeLog

PR tree-optimization/68083
* gcc.dg/torture/pr68083.c: New.  From Zhendong Su.

From-SVN: r229690
ChangeLog
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr68083.c [new file with mode: 0644]
gcc/tree-ssa-ifcombine.c
gcc/tree-ssa.c
gcc/tree-ssa.h