From: Andrew Pinski Date: Tue, 13 May 2025 20:50:24 +0000 (-0700) Subject: gimple: Add assert for code being a comparison in gimple_cond_set_code X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a770e52028c010f31d86d0fed3635916f5852fd;p=thirdparty%2Fgcc.git 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 --- 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; }