https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104988
Bug ID: 104988
Summary: Zero register (R1) clobbered by __udivmodsi4 for AVR
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcc
Assignee: unassigned at gcc dot gnu.org
Reporter: dv at vollmann dot ch
CC: dv at vollmann dot ch
Target Milestone: ---
Created attachment 52652
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52652&action=edit
compiler configuration
Line 1630 in libgcc/config/avr/lib1funcs.S defined r_cnt as __zero_reg__ and
uses it as loop count, i.e. it sets it to a non-zero value.
This is fine if the loop reaches its end, but causes chaos if there's an
interrupt before the loop end.
__zero_reg__ should never be set to a non-zero value!
Looking through the file there seem to be a number of other places where
__zero_reg__ is modified.