GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-ssa-forwprop

Do not handle COMPLEX types in simplify_phi_result_movdiv.

Fixes ICE when optimizing division/modulo on complex numbers.

This commit prevents an ICE (Internal Compiler Error) in the simplify_phi_result_movdiv function within the tree-ssa forward propagation pass. The function was incorrectly attempting to process COMPLEX types for division or modulo operations, which are not designed for them. The fix adds a check to ensure operands are integral types before applying the transformation, filtering out complex types.

In Details

The simplify_phi_result_movdiv function in tree-ssa-forwprop.cc handles specific GIMPLE statements involving PHI nodes and division/modulo operations. An earlier commit (not provided here) introduced logic that inadvertently triggered an integer constant check even when the operands were COMPLEX types. This patch adds an INTEGRAL_TYPE_P check to filter out complex types, preventing the ICE and ensuring the transformation is only applied where it's mathematically sound.

For Context
ICE
Internal Compiler Error. An unexpected condition encountered by the compiler that prevents it from completing the compilation process. It typically indicates a bug in the compiler itself.
tree-ssa-forwprop
The forward propagation pass within GCC's tree-ssa optimization framework. It attempts to propagate constants and simplify expressions by moving computations closer to their uses.
PHI node
In SSA form, a PHI node is a special construct used to merge values from different control flow paths. It selects one of its arguments based on which predecessor block was taken.
COMPLEX types
Data types representing complex numbers, which consist of a real part and an imaginary part. Compilers may have specific intrinsic functions or support for arithmetic operations on these types.
Filed Under: optimizationbugfixcomplex numbers