[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bugs #4101] setjmp/longjmp destroy changes in global

From: Dmitry K.
Subject: Re: [avr-libc-dev] [bugs #4101] setjmp/longjmp destroy changes in global registers
Date: Sat, 8 Jan 2005 13:56:45 +1000
User-agent: KMail/1.5


Simple test is:
   This is a test program for avr-libc bug #4101: "setjmp/longjmp
   destroy changes in global registers". Global register `reg' is
   cleared on the run of program, but longjmp() restores its old value
   -- 1. Return from main() indicates about this error.

   Extra function foo() is introduced only to demonstrate preservation
   of call-saved registers by the compiler. (It is no necessary do it
   on the main level, and compiler known about it.)
#include <setjmp.h>

register unsigned char reg asm("r2");
jmp_buf env;

int foo (void)
    if (setjmp(env))
        return reg;
    reg = 0;
    longjmp(env, 1);

int main ()
    reg = 1;
    return foo();

Tarball with test scripts and preliminary patch is sended to savannah.

Thanks for mention.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]