Repository navigation
throw.h: use setjmp/longjmp with clang on MinGW - #7772
Conversation
The MinGW branch picks __builtin_setjmp/__builtin_longjmp for any
compiler that defines __GNUC__ >= 4, and clang does. Clang declares
__builtin_setjmp as taking a void **, while jmp_buf on mingw-w64 is an
array of struct _SETJMP_FLOAT128, so llvm-mingw (clang 23) stops at the
first MRB_TRY/MRC_TRY with -Wincompatible-pointer-types, which is an
error there:
codegen.c:221:3: error: incompatible pointer types passing
'jmp_buf' (aka 'struct _SETJMP_FLOAT128[16]') to parameter of type
'void **'
Casting the buffer to void ** gets the build through, but then the
first exception crashes: `begin; raise "x"; rescue; end` segfaults and
mrbtest dies before its first test, as mruby#5950 reported. Leave clang out
of the builtin branch, as was done for ARM64 in mruby#6637, so it uses the
setjmp()/longjmp() from <setjmp.h>. GCC keeps the builtins. The same
condition is in mrc_throw.h.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
The MinGW branch picks __builtin_setjmp/__builtin_longjmp for any
compiler that defines GNUC >= 4, and clang does. Clang declares
__builtin_setjmp as taking a void **, while jmp_buf on mingw-w64 is an
array of struct _SETJMP_FLOAT128, so llvm-mingw (clang 23) stops at the
first MRB_TRY/MRC_TRY with -Wincompatible-pointer-types, which is an
error there:
Casting the buffer to void ** gets the build through, but then the
first exception crashes:
begin; raise "x"; rescue; endsegfaults andmrbtest dies before its first test, as #5950 reported. Leave clang out
of the builtin branch, as was done for ARM64 in #6637, so it uses the
setjmp()/longjmp() from <setjmp.h>. GCC keeps the builtins. The same
condition is in mrc_throw.h.
Summary by CodeRabbit