GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
internal-fn

Fix ICE during IFN_CLMUL expansion

Prevents compiler crash when unused CLMUL intrinsic results are not optimized out.

This change modifies internal-fn.cc to prevent an Internal Compiler Error (ICE) during the expansion of CLMUL intrinsics. Previously, when the left-hand side of these intrinsics was unused and not optimized out (e.g., at -O0), the compiler would attempt to expand a NULL_TREE, leading to a crash. The fix ensures that if the left-hand side is NULL_TREE, the expansion is skipped, aligning with the handling of other ECF_CONST intrinsics.

In Details

The change addresses an ICE in expand_CLMUL and expand_CLMUL_WIDEN within GCC's internal-fn.cc. These functions handle CLMUL intrinsics which are marked with ECF_CONST. When the LHS is NULL_TREE and not DCEd (e.g., at -O0), attempting to expand it causes an ICE. This patch adds a check to do nothing if LHS is NULL_TREE, similar to how other ECF_CONST IFNs are handled, preventing the crash.

Filed Under: optimizationcompiler-error