Found this in the very good 'Advanced Programming in the UNIX® Environment' book:

The author(s) could add the following note: the reason of this behaviour is because setjmp()/longjmp() functions can save/restore only current registers, not any elements in local stack.

Optimizing compiler usually allocate most busy variables in registers.

Hence, longjmp() can restore these variables, if they are allocated in registers.

More explanation about these functions you can find in my book.

But in my opinion, these functions are too 'hackish', they cannot be used in a serious 'production' and truly portable code.

List of my other blog posts.