aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.h
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-07-31 15:00:06 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-06 08:50:40 +0200
commit3334fa789234c05da18b9e0e284bc04e5ef6b39b (patch)
tree830a09a4ce171452bab3fc9da5778c86048021eb /evaluate.h
parent875235a6801d1c5a9ccc9c265fe45a8f6a0f87c0 (diff)
downloadsparse-dev-3334fa789234c05da18b9e0e284bc04e5ef6b39b.tar.gz
fix linearize_conditional() for logical ops
The function linearize_conditional(), normaly used for conditionals (c ? a : b) is also used to linearize the logical ops || and &&. For conditionals, the type evaluation ensure that both LHS & RHS have consistent types. However, this is not the case when used for logical ops. This creates 2 separated but related problems: * the operands are not compared with 0 as required by the standard (6.5.13, 6.5.14). * both operands can have different, incompatible types and thus it's possible to have a phi-node with sources of different, incompatible types, which doesn't make sense. Fix this by: * add a flag to linearize_conditional() telling if it's used for a conditional or for a logical op. * when used for logical ops: * first compare the operands againts zero * convert the boolean result to the expression's type. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.h')
0 files changed, 0 insertions, 0 deletions