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

SH: Fix __builtin_sh_{get,set}_fpscr ICE on targets without FPU

Correctly enables FP register built-ins only on SH targets with an FPU.

Previously, _builtin_sh{get,set}_fpscr was enabled on SH targets even if they lacked an FPU, leading to an ICE. This change modifies the condition for enabling these built-ins to correctly check for the presence of TARGET_FPU_ANY, preventing the ICE and ensuring they are only available when an FPU is present. New test cases verify this fix.

In Details

The SH built-ins __builtin_sh_get_fpscr and __builtin_sh_set_fpscr were incorrectly enabled when TARGET_SH1 was defined, regardless of FPU support. Their RTL expansions, however, require TARGET_FPU_ANY. This commit adjusts the conditional logic in gcc/config/sh/sh.cc to check TARGET_FPU_ANY instead of TARGET_SH1 for enabling these built-ins, thus aligning feature availability with actual hardware capabilities.

For Context
ICE
Internal Compiler Error. A condition that causes the compiler to crash during translation.
RTL
Register Transfer Language. An intermediate representation used by GCC to represent code before it is optimized and translated to machine code.
TARGET_FPU_ANY
A GCC target configuration macro that indicates if the target architecture supports any floating-point unit.
TARGET_SH1
A GCC target configuration macro specific to the SH-1 architecture, a subset of the SuperH architecture.
Filed Under: shbuiltinscompiler error