public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/104988] New: Zero register (R1) clobbered by __udivmodsi4 for AVR
@ 2022-03-19 23:28 dv at vollmann dot ch
  2022-03-19 23:54 ` [Bug target/104988] " dv at vollmann dot ch
  2022-04-03 19:21 ` gjl at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: dv at vollmann dot ch @ 2022-03-19 23:28 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/104988] Zero register (R1) clobbered by __udivmodsi4 for AVR
  2022-03-19 23:28 [Bug libgcc/104988] New: Zero register (R1) clobbered by __udivmodsi4 for AVR dv at vollmann dot ch
@ 2022-03-19 23:54 ` dv at vollmann dot ch
  2022-04-03 19:21 ` gjl at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: dv at vollmann dot ch @ 2022-03-19 23:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104988

--- Comment #1 from dv at vollmann dot ch ---
Sorry, it looks like it's my fault: the compiler saves and clears __zero_reg__
for ISRs so I have to do this in my assembler ISRs myself and it's correct for
a function to temporarily store a non-zero value in __zero_reg__.

Sorry for the noise.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/104988] Zero register (R1) clobbered by __udivmodsi4 for AVR
  2022-03-19 23:28 [Bug libgcc/104988] New: Zero register (R1) clobbered by __udivmodsi4 for AVR dv at vollmann dot ch
  2022-03-19 23:54 ` [Bug target/104988] " dv at vollmann dot ch
@ 2022-04-03 19:21 ` gjl at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2022-04-03 19:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104988

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
As you already found out this PR is invalid, thus closing.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-03 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 23:28 [Bug libgcc/104988] New: Zero register (R1) clobbered by __udivmodsi4 for AVR dv at vollmann dot ch
2022-03-19 23:54 ` [Bug target/104988] " dv at vollmann dot ch
2022-04-03 19:21 ` gjl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).