From 9a770e52028c010f31d86d0fed3635916f5852fd Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Tue, 13 May 2025 13:50:24 -0700 Subject: [PATCH] gimple: Add assert for code being a comparison in gimple_cond_set_code We have code later on that verifies the code is a comparison. So let's try to catch it earlier. So it is easier to debug where the incorrect code gets set. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * gimple.h (gimple_cond_set_code): Add assert of the code being a comparison. Signed-off-by: Andrew Pinski --- gcc/gimple.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/gimple.h b/gcc/gimple.h index 977ff1c923c..94d5a13fcb2 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3716,6 +3716,7 @@ gimple_cond_code (const gimple *gs) inline void gimple_cond_set_code (gcond *gs, enum tree_code code) { + gcc_gimple_checking_assert (TREE_CODE_CLASS (code) == tcc_comparison); gs->subcode = code; } -- 2.47.2