https://gcc.gnu.org/g:9a770e52028c010f31d86d0fed3635916f5852fd

commit r16-628-g9a770e52028c010f31d86d0fed3635916f5852fd
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue May 13 13:50:24 2025 -0700

    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 <quic_apin...@quicinc.com>

Diff:
---
 gcc/gimple.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index 977ff1c923c5..94d5a13fcb20 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;
 }

Reply via email to