GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
genmatch

genmatch: Fix gen_checking for PR127308

Corrected `gen_checking` logic in `genmatch` to properly compare identifiers, fixing a bug that affected `CONVERT_EXPR` and `NOP_EXPR`.

This commit fixes a bug in the genmatch component where the gen_checking function incorrectly compared expression IDs instead of identifiers. While this did not cause issues in practice because CONVERT_EXPR and NOP_EXPR were not used as possible values, the fix ensures correct behavior for future use cases. The change involves correcting the comparison logic within c_code_id::gen_checking.

In Details

The genmatch.cc file, specifically the c_code_id::gen_checking function, is updated to rectify an error in comparing expression types. The previous implementation compared id instead of identifier when checking for CONVERT_EXPR or NOP_EXPR among possible values. This fix ensures accurate matching of expression kinds in the genmatch utility.

For Context
genmatch
A GCC internal utility used for matching patterns in the compiler's intermediate representation (like GIMPLE or RTL). It helps in recognizing specific code structures for optimization or code generation.
CONVERT_EXPR
A GIMPLE expression type representing an explicit type conversion.
NOP_EXPR
A GIMPLE expression type that represents a no-operation, often used as a placeholder or for semantic purposes.
Identifier
In programming, a name used to identify a variable, function, class, or other entity. In the context of GCC's internal representation, it refers to the specific type or kind of an expression or node.
Filed Under: genmatchbugfixcompiler internals