https://gcc.gnu.org/g:f98f69a2f64f3679a06cd0e9b7c7fa5eb7a572ff

commit f98f69a2f64f3679a06cd0e9b7c7fa5eb7a572ff
Author: Alexandre Oliva <ol...@gnu.org>
Date:   Thu Nov 21 22:36:50 2024 -0300

    do not assume andor code

Diff:
---
 gcc/gimple-fold.cc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 73a22ad3be59..7d7471e5ed76 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -7983,8 +7983,21 @@ fold_truth_andor_maybe_separate (location_t loc,
       || TREE_CODE_CLASS (rcode) != tcc_comparison)
     return 0;
 
-  code = ((code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR)
-         ? TRUTH_AND_EXPR : TRUTH_OR_EXPR);
+  switch (code)
+    {
+    case TRUTH_AND_EXPR:
+    case TRUTH_ANDIF_EXPR:
+      code = TRUTH_AND_EXPR;
+      break;
+
+    case TRUTH_OR_EXPR:
+    case TRUTH_ORIF_EXPR:
+      code = TRUTH_OR_EXPR;
+      break;
+
+    default:
+      return 0;
+    }
 
   bool lsignbit = false, rsignbit = false;
   if ((lcode == LT_EXPR || lcode == GE_EXPR)

Reply via email to