| Issue |
233464
|
| Summary |
[clang][ObjC] Crash in codegen for @try with both @catch and @finally on windows-msvc (GNUstep runtime)
|
| Labels |
|
| Assignees |
|
| Reporter |
Alepacho
|
Labels: clang:codegen, objective-c, platform:windows, crash
Clang crashes during IR generation for any Objective-C `@try` statement that has both a `@catch` and a `@finally` clause when targeting `*-pc-windows-msvc` with the GNUstep runtime.
```objc
// crash.m
void g(void);
void f(void) {
@try {
g();
} @catch (id e) {
} @finally {
}
}
```
```
clang -fobjc-runtime=gnustep-2.0 -fobjc-exceptions -fexceptions -c crash.m
```
Output (clang 23.1.3):
```
Stack dump:
0. Program arguments: clang.exe -fobjc-runtime=gnustep-2.0 -fobjc-exceptions -fexceptions -c -o NUL crash.m
1. <eof> parser at end of file
2. crash.m:3:6: LLVM IR generation of declaration 'f'
3. crash.m:3:6: Generating code for declaration 'f'
Exception Code: 0xC0000005
clang: error: clang frontend command failed due to signal (use -v to see invocation)
```
Depending on the input, it also fails with `LLVM ERROR: out of memory` / `Allocation failed` (clang 22.1.8 reported exception code `0xC000001D`).
- Reproduces with: `x86_64-pc-windows-msvc` and `i686-pc-windows-msvc`, `-fobjc-runtime=gnustep-2.0` and `gnustep-1.9`, with or without `-g`, at `-O0`.
- Does **not** reproduce with `x86_64-unknown-linux-gnu`.
- The catch type does not matter: `@catch (id e)`, `@catch (SomeClass *e)` and `@catch (...)` all crash.
- `@try/@catch` alone and `@try/@finally` alone compile fine. Nesting them works as a workaround:
`@try { @try { ... } @catch (id e) { ... } } @finally { ... }`
Versions: clang 22.1.8 and 23.1.3 (official Windows release builds), Windows 11 x64.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs