]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use a boolean type when folding conditionals in simplify_using_ranges.
authorAldy Hernandez <aldyh@redhat.com>
Thu, 16 May 2024 07:22:55 +0000 (09:22 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 16 May 2024 09:57:48 +0000 (11:57 +0200)
In adding some traps for PR114985 I noticed that the conditional
folding code in simplify_using_ranges was using the wrong type.  This
cleans up the oversight.

gcc/ChangeLog:

PR tree-optimization/114985
* vr-values.cc (simplify_using_ranges::fold_cond_with_ops): Use
boolean type when folding conditionals.

gcc/vr-values.cc

index 0572bf6c8c733c94483c7906cab24159085c5fb3..e6ea9592574fa0a8378d9cb32591d58a3b97286f 100644 (file)
@@ -316,10 +316,9 @@ simplify_using_ranges::fold_cond_with_ops (enum tree_code code,
       || !query->range_of_expr (r1, op1, s))
     return NULL_TREE;
 
-  tree type = TREE_TYPE (op0);
   int_range<1> res;
   range_op_handler handler (code);
-  if (handler && handler.fold_range (res, type, r0, r1))
+  if (handler && handler.fold_range (res, boolean_type_node, r0, r1))
     {
       if (res == range_true ())
        return boolean_true_node;