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

AVR: Fix ICE 'incomplete application of insn' in fuse-move pass

Fixes an ICE in the AVR backend's fuse-move pass by correctly tracking clobbered registers during optimization.

This commit resolves an Internal Compiler Error (ICE) in the AVR backend’s fuse-move RTL pass. The ICE occurred when an optimization attempted to replace a libgcc call for multiplication with a constant, but failed to account for all registers clobbered by the original libgcc call. The fix ensures the optimization pass correctly identifies and ignores all such clobbered registers, passing tests and fixing an ICE for targets lacking hardware multiplication.

In Details

The AVR backend's fuse-move pass optimizes sequences of RTL instructions. An ICE was triggered when optimizing a SImode multiplication implemented via a libgcc transparent call. The optimize_data_t::ignore_mask failed to include all registers clobbered by the original libgcc sequence. This patch corrects ignore_mask calculation by traversing the old pattern to find all scratch registers, resolving the ICE, particularly for targets without hardware multiply, and specifically when using the -mpr118012 workaround.

For Context
AVR
A family of microcontrollers developed by Atmel (now Microchip Technology). GCC has a backend to generate code for these processors.
ICE
Internal Compiler Error. A condition where the compiler encounters an unrecoverable internal state, causing it to terminate.
RTL
Register Transfer Language. An intermediate representation used by GCC that describes the computation in terms of transfers between registers and memory.
fuse-move pass
A compiler pass, likely within the GCC RTL optimization stages, that identifies and potentially merges or replaces sequences of instructions related to data movement and other operations.
libgcc call
A call to a function within the GCC runtime library (libgcc), often used for operations not directly supported by the target architecture's instruction set, such as hardware multiplication on some AVR variants.
SImode
A mode in GCC's intermediate representation representing a single integer (typically 32 bits).
-mpr118012
A compiler flag related to a specific bug report (PR 118012) for the AVR target, likely a workaround that influences how libgcc functions are called.
Filed Under: gccavrbackendoptimizationICE