[compiler-rt] [llvm] [ASan] Do not instrument catch block parameters on Windows (PR #159618)
David Justo via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 30 22:42:12 PDT 2025
davidmrdavid wrote:
Following up to this request: https://github.com/llvm/llvm-project/pull/159618#discussion_r2373661371
I could use a bit of assistance, I think I'm doing something wrong.
So, I _tried_ producing the `.ll` post asan-pass for my change, and without my change. When comparing the resulting `.ll`s, they appear identical, despite them producing very different runtime outcomes when using `clang` in full.
I suspect I'm doing something wrong when generating these `.ll` files.
For debugging, this is the `.cpp` file I'm using as a base:
```C++
class MyClass {};
#include <exception>
#include <cstdio>
int main() {
try {
throw 1;
} catch (const int ex) {
printf("%d\n", ex);
return -1;
}
return 0;
}
```
(please ignore the dead code of `class MyClass {} and the include of `exception``. I forgot to remove them when generating the `.ll`, with is an arduous process when doing with and without my change).
To obtain the `.ll` post asan-pass **without my change**, I'm running the following sequence of commands:
```
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\clang.exe -g0 -O0 -emit-llvm -c main.cpp -o main_before.bc
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\llvm-extract.exe -func=main main_before.bc -o main_func_before.bc
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\llvm-dis.exe main_func_before.bc -o main_func_dis_before.ll
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\\opt.exe -S main_func_dis_before.ll -passes=asan > out_before.txt
// ... and this is just a sanity check that the error persists at runtime
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\clang.exe -fsanitize=address -g -O0 main.cpp & a.exe
-978572156
```
To obtain the `.ll` post asan-pass **with my change**, I'm running these commands instead:
```
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\clang.exe -g0 -O0 -emit-llvm -c main.cpp -o main_after.bc
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\llvm-extract.exe -func=main main_after.bc -o main_func_after.bc
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\llvm-dis.exe main_func_after.bc -o main_func_dis_after.ll
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\\opt.exe -S main_func_dis_after.ll -passes=asan > out_after.txt
// ... and this is just a sanity check the error is fixed at runtime
C:\Users\dajusto\source\repos\llvm-project\build.runtimes\bin\clang.exe -fsanitize=address -g -O0 main.cpp & a.exe
1
```
Below, I'm attaching my `out_before.txt` and `out_after.txt` files, which are nearly identical except that the "Module ID" is naturally different.
[out_before.txt](https://github.com/user-attachments/files/22631370/out_before.txt)
[out_after.txt](https://github.com/user-attachments/files/22631369/out_after.txt)
This doesn't seem right, does it? Am I doing something obviously wrong? Thanks!
https://github.com/llvm/llvm-project/pull/159618
More information about the llvm-commits
mailing list