This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] Fix PR tree-opt/32100 vrp bitfield (signed:1) miscompilation


Hi,
  The problem here is that tree_expr_nonnegative_warnv_p would return true 
for conditional expressions when the type is signed:1 which is wrong as 
conditional expressions with that final type will have the values of -1 
(true) and 0 (false).  This causes VRP to think the conditional expression 
to be non negative and give the range of the conditional expression as 
[0,0] which was wrong.
This patch fixes this case for truth_value_p expression.

Committed as obvious to the trunk and the 4.2 branch after a 
bootstrap/test on i686-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

        * fold-const.c (tree_expr_nonnegative_warnv_p): Don't
        return true when truth_value_p is true and the type
        is of signed:1.

        * gcc.c-torture/execute/vrp-7.c: New test.


Attachment: fixpr32100.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]