glsl: Avoid division-by-zero during constant-folding
authorChad Versace <chad.versace@intel.com>
Tue, 1 Feb 2011 18:14:28 +0000 (10:14 -0800)
committerChad Versace <chad.versace@intel.com>
Wed, 2 Feb 2011 17:55:35 +0000 (09:55 -0800)
commite7c1f058d18f62aa4871aec623f994d7b68cb8c1
tree00df3e53e937b1d8c13d3a81a3367a3e1480ae0e
parentb3cf92aa916ee0537ee37723c23a9897ac9cd3e0
glsl: Avoid division-by-zero during constant-folding

Avoid division-by-zero when constant-folding the following expression
types:
    ir_unop_rsq
    ir_binop_div
    ir_binop_mod

Fixes bugs:
https://bugs.freedesktop.org//show_bug.cgi?id=33306
https://bugs.freedesktop.org//show_bug.cgi?id=33508

Fixes Piglit tests:
glslparsertest/glsl2/div-by-zero-01.frag
glslparsertest/glsl2/div-by-zero-02.frag
glslparsertest/glsl2/div-by-zero-03.frag
glslparsertest/glsl2/modulus-zero-01.frag
glslparsertest/glsl2/modulus-zero-02.frag

NOTE: This is a candidate for the 7.9 and 7.10 branches.
src/glsl/ir_constant_expression.cpp