[PATCH] Remove dead code from scalar_binop

Tom Tromey tromey@adacore.com
Wed Mar 1 21:27:08 GMT 2023


scalar_binop has code for "&&" and "||", but I think this code can't
currently be run -- and, furthermore, it doesn't make sense to have
this code here, as the point of these operators is to short-circuit
evaluation.

This patch removes the dead code.

Regression tested on x86-64 Fedora 36.
---
 gdb/valarith.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/gdb/valarith.c b/gdb/valarith.c
index 6ea0cd9e8d1..ad53febcedc 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1331,14 +1331,6 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 	      v = v1 ^ v2;
 	      break;
 
-	    case BINOP_LOGICAL_AND:
-	      v = v1 && v2;
-	      break;
-
-	    case BINOP_LOGICAL_OR:
-	      v = v1 || v2;
-	      break;
-
 	    case BINOP_MIN:
 	      v = v1 < v2 ? v1 : v2;
 	      break;
@@ -1492,14 +1484,6 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
 	      v = v1 ^ v2;
 	      break;
 
-	    case BINOP_LOGICAL_AND:
-	      v = v1 && v2;
-	      break;
-
-	    case BINOP_LOGICAL_OR:
-	      v = v1 || v2;
-	      break;
-
 	    case BINOP_MIN:
 	      v = v1 < v2 ? v1 : v2;
 	      break;
-- 
2.39.1



More information about the Gdb-patches mailing list