[LLVMbugs] [Bug 11987] New: Should static variable roll back it's value when use setjmp()/longjmp() with Clang -O option?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 12 08:36:59 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11987

             Bug #: 11987
           Summary: Should static variable roll back it's value when use
                    setjmp()/longjmp() with Clang -O option?
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: cqlangyi at 163.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8045
  --> http://llvm.org/bugs/attachment.cgi?id=8045
compliled with "clang -O jmp_test.c"

jmp_test.c compiled with optimization option "clang -O jmp_test.c"

when run ./a.out, the output is:
-----------------------
in f1():
g, a, r, v, s
91, 92, 93, 94, 95
after long jump:
g, a, r, v, s
91, 2, 3, 94, 5
-----------------------

my question is:

should static variable such as "int static_val" roll back it's
value after longjmp()? it's value should be 95 or 5?


the code is attached below.

thank you.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list