]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gimple: Add assert for code being a comparison in gimple_cond_set_code
authorAndrew Pinski <quic_apinski@quicinc.com>
Tue, 13 May 2025 20:50:24 +0000 (13:50 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Wed, 14 May 2025 14:56:22 +0000 (07:56 -0700)
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 <quic_apinski@quicinc.com>
gcc/gimple.h

index 977ff1c923c5d95272533729aa9cec45a82cc03b..94d5a13fcb20e5f5ff82ec686471a78dd5ee888d 100644 (file)
@@ -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;
 }