avrdudes / avr-libc

The AVR-LibC package provides a subset of the standard C library for AVR 8-bit RISC microcontrollers.
https://avrdudes.github.io/avr-libc/
Other
266 stars 57 forks source link

[bug #4101] setjmp/longjmp destroy changes in global registers #33

Closed avrs-admin closed 2 years ago

avrs-admin commented 2 years ago

Wed 25 Jun 2003 10:57:54 PM CEST

A prologue/epilogue of function, in which there is a call setjmp(), contains preservation/restoration of all call-saved registers. Exception make function main() and global register variables. Nevertheless, setjmp/longjmp too keeps/restores registers r2-r17. Restoration of local variables after operation longjmp(), certainly is pleasant, but it is no necessary. But loss of changes in global registers, in my opinion, is inadmissible.

avr-gcc (GCC) 3.3.1 20030519 (prerelease) avr-libc-20030422cvs

file #2340: 20050108-setjmp.tar.gz file #2344: setjmp-20050109.tar.gz file #2346: setjmp-20050110.tar.gz

This issue was migrated from https://savannah.nongnu.org/bugs/?4101

avrs-admin commented 2 years ago

Eric Weddington Fri 07 Jan 2005 08:08:23 PM CET

Is there a simple test case for this? Or, better still, is there a patch that fixes the problem?

We'd really like to get this one fixed....

avrs-admin commented 2 years ago

Sun 09 Jan 2005 08:58:43 AM CET

Tarball with patched setjmp (S and h) and a set of tests. To test, untar last attached file and run setjmp-tst.sh . Simulavr is needed.

avrs-admin commented 2 years ago

Mon 10 Jan 2005 07:07:58 AM CET

Final (I hope) version of modifyed setjmp (20050110). Test set is expanded.

Shortly: saving/restoring registers r2-r17 is excluded from setjmp.

avrs-admin commented 2 years ago

Joerg Wunsch Sun 16 Jan 2005 07:30:39 PM CET

As there is currently no fix in sight that would not break legitimate programs, I documented the problem.