diff mbox series

Remove call to gcc_unreachable in range-op.cc

Message ID 1782395.tdWV9SEqCh@fomalhaut
State New
Headers show
Series Remove call to gcc_unreachable in range-op.cc | expand

Commit Message

Eric Botcazou May 8, 2021, 5:43 p.m. UTC
Hi,

the attached Ada testcase happens to stumble on the call to gcc_unreachable in 
operator_bitwise_xor::op1_range.  My understanding is that there is nothing 
wrong going on and that it's safe to let it go through.

Tested on x86-64/Linux, OK for mainline and 11 branch?


2021-05-08  Eric Botcazou  <ebotcazou@adacore.com>

	* range-op.cc (get_bool_state): Adjust head comment.
	(operator_not_equal::op1_range): Fix comment.
	(operator_bitwise_xor::op1_range): Remove call to gcc_unreachable.


2021-05-08  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/opt5.ads: New test.
	* gnat.dg/specs/opt5_pkg.ads: New helper.
diff mbox series

Patch

diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index ab8f4e211ac..742e54686b4 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -358,10 +358,8 @@  range_true_and_false (tree type)
 
 enum bool_range_state { BRS_FALSE, BRS_TRUE, BRS_EMPTY, BRS_FULL };
 
-// Return the summary information about boolean range LHS.  Return an
-// "interesting" range in R.  For EMPTY or FULL, return the equivalent
-// range for TYPE, for BRS_TRUE and BRS false, return the negation of
-// the bool range.
+// Return the summary information about boolean range LHS.  If EMPTY/FULL,
+// return the equivalent range for TYPE in R; if FALSE/TRUE, do nothing.
 
 static bool_range_state
 get_bool_state (irange &r, const irange &lhs, tree val_type)
@@ -383,6 +381,7 @@  get_bool_state (irange &r, const irange &lhs, tree val_type)
       r.set_varying (val_type);
       return BRS_FULL;
     }
+
   return BRS_TRUE;
 }
 
@@ -538,7 +537,7 @@  operator_not_equal::op1_range (irange &r, tree type,
       break;
 
     case BRS_FALSE:
-      // If its true, the result is the same as OP2.
+      // If it's false, the result is the same as OP2.
       r = op2;
       break;
 
@@ -2643,7 +2642,7 @@  operator_bitwise_xor::op1_range (irange &r, tree type,
 	  r = op2;
 	  break;
 	default:
-	  gcc_unreachable ();
+	  break;
 	}
       return true;
     }