3 ms·
ISO C says that any local variables that are not declared volatile whose values are mutated after the context is saved with setjmp then have indeterminate value
by kazinator 7y ago
ISO C says that any local variables that are not declared volatile whose values are mutated after the context is saved with setjmp then have indeterminate values when the context is restored with longjmp. So yes, that interacts with optimization. Any variable that is cached in a register may revert to its old value when that register is restored blindly from jmp_buf.