- Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillallvmUmbrella label for LLVM issuesUmbrella label for LLVM issues
Description
| Bugzilla Link | 51729 |
| Version | trunk |
| OS | Linux |
| Blocks | #50580 #51489 |
| Attachments | Repro, Repro (with workaround added), bsjlj.ll diff with D109248 applied |
| CC | @aeubanks,@DimitryAndric,@RKSimon,@tstellar |
Extended Description
Tested with 13.0.0-rc2 and 12.0.1. The repro could be made shorter.
Note that this issue is not necessarily specific to X86_64. A segfault is also observed for ARM.
$ cat bsjlj.cvoid foo(void **jb, int n); void bar(int n); void bsj(void **jb, volatile int n) { if (__builtin_setjmp(jb) == 0) { foo(jb, n); } else { bar(n); } } void blj(void **jb) { __builtin_longjmp(jb, 1); } int printf (const char *__restrict __format, ...); void foo(void **jb, int n) { printf("foo: n = %d\n", n); blj(jb); } void bar(int n) { printf("bar: n = %d\n", n); } int main(int argc, char *argv[] __attribute__((unused))) { void *jb[5]; bsj(jb, argc); bsj(jb, argc+1); return 0; }$ /usr/lib/llvm/12/bin/clang --target=x86_64-linux-gnu bsjlj.c -Oz -Wall -Wextra -Wundef $ ./a.out foo: n = 1 bar: n = 1 foo: n = 2 bar: n = 2 $ /usr/lib/llvm/13/bin/clang --target=x86_64-linux-gnu bsjlj.c -Oz -Wall -Wextra -Wundef $ ./a.out foo: n = 1 bar: n = 32764 Segmentation faultMetadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillallvmUmbrella label for LLVM issuesUmbrella label for LLVM issues