https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84521
--- Comment #22 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Eric Botcazou from comment #21) > > You can use __builtin_setjmp and __builtin_longjmp in the same function, > > only if they use a different buffer. Otherwise it is invalid. > > Yes, that's invalid. Where exactly is this documented? I can't find no references to __builtin_setjmp or __builtin_longjmp in https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc.pdf or https://gcc.gnu.org/onlinedocs/gccint.pdf. > > CCing Eric for the other __builtin_setjmp related issues. > > I don't see anything special with Aarch64 that would make it impossible to > support __builtin_setjmp/__builtin_longjmp properly. You can parameterize a > lot of things in the back-end with TARGET_BUILTIN_SETJMP_FRAME_VALUE and > various patterns like: > save_stack_nonlocal > restore_stack_nonlocal, > nonlocal_goto_receiver, > builtin_setjmp_setup, > builtin_setjmp_receiver, > builtin_longjmp > See the documentation and existing ports. Which documentation? Like you say, AArch64 doesn't need anything special, it's the mid-end implementation that is broken here. I bet most of my examples fail on other targets too.