[PR68083] don't introduce undefined behavior in ifcombine
commit4883b25095606e230d3d2a2b328f9609020369b9
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Nov 2015 00:30:07 +0000 (3 00:30 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Nov 2015 00:30:07 +0000 (3 00:30 +0000)
tree97886b9d02ac0ccd0177983b325624a1c00e5f03
parent3e5c6b624e87520e1758bfc731f6e4ebd2c77844
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229690 138bc75d-0d04-0410-961f-82ee72b054a4
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