GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
builtins

Complete trigonometric pi-based builtin mappings

Fixes an ICE by correctly mapping trigonometric pi-based builtins to their declarations.

An oversight in GCC’s built-in function handling caused an Internal Compiler Error (ICE) when dealing with trigonometric functions based on pi (e.g., sinpi, cospi). These functions were not included in the SEQ_OF_CASE_MATHFN macro, preventing the compiler from mapping them to appropriate type-specific declarations. This patch adds the missing functions to the macro and updates builtin_with_linkage_p to resolve the ICE and ensure proper handling.

In Details

In builtins.cc, the mathfn_built_in_2 function's SEQ_OF_CASE_MATHFN macro was missing trigonometric pi-based builtins. This caused an ICE because combined_fn codes for these functions could not be mapped to type-specific builtin declarations. This change adds these functions to the macro and also updates builtin_with_linkage_p to treat them as library functions and adjust their order, ensuring correct handling during builtin lookup.

For Context
ICE
Internal Compiler Error. An unrecoverable error that occurs within the compiler itself, typically indicating a bug in the compiler's logic.
builtin function
A function that is recognized and handled directly by the compiler, often providing optimized implementations for common operations or specific hardware features. Examples include __builtin_memcpy or mathematical functions.
trigonometric functions
Mathematical functions that relate an angle of a right-angled triangle to the ratios of its sides. Examples include sine, cosine, and tangent.
pi-based trigonometric functions
Trigonometric functions that take an angle expressed as a multiple of pi as input, such as sinpi(x) = sin(x * pi).
Filed Under: builtinscompiler errortrigonometrymath library