Bugzilla – Bug 77
Variables in scope of output setjmp calls should be volatile
Last modified: 2003-11-16 16:09:21
You need to log in before you can comment on or make changes to this bug.
ISO 9899 7.13.2.1 (3) says that "[...] the values of objects of automatic storage duration that are local to the function containing the invocation of the [...] setjmp macro that do not have volatile-qualified type and have been changed between the setjmp invocation and longjmp call are indeterminate." We should probably be marking all auto variables in the scope of a setjmp volatile, to be safe. So far, this has not bitten us, but this seems to prove only that we have been lucky.
This should definately be fixed, but we probably want to make it conditional somehow. If we don't, every variable in a function which uses 'invoke' will have to be marked volatile. That's not cool. Also, note that this only effects platforms which do not use the "snapshot of register state" way of implementing setjmp/longjmp. I do not believe this effects sparc or X86.
Fixed like so: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031110/009568.html Any targets which do not require volatile markers on variables which setjmp should extend this patch to avoid slowing down code that uses exception handling. I don't know whether the Sparc fits in this class or not, so I conservatively didn't include it. -Chris