http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55214



Tobias Burnus <burnus at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

           Keywords|                            |wrong-code

             Status|UNCONFIRMED                 |NEW

   Last reconfirmed|                            |2012-11-05

                 CC|                            |burnus at gcc dot gnu.org

     Ever Confirmed|0                           |1



--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-05 
14:56:56 UTC ---

Confirmed - and not a regression as it also fails with GCC 4.1.



>From the C-like dump file (use -fdump-tree-original to create it):



For WHERE (L), one has:

            cond.3 = (logical(kind=1)) l[S.2 + -1];

            temp.0[count.1] = cond.3;



Which is then used in WHERE (SQRT(X)>0):



            cond.7 = __builtin_sqrtf (x[S.6 + -1]) > 0.0;

            mask.8 = temp.0[count.5];

            temp.4[count.5] = mask.8 && cond.7;



The proper way would be:

   mask.8 = temp.0[count.5];

   temp.4[count.5] = mask.8 ? __builtin_sqrtf (x[S.6 + -1]) > 0.0 : mask.8;



That is, the condition only gets evaluated if the outer mask is true.

Reply via email to