Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impact of infinite loops on sanitizers #99010

Open
bi6c opened this issue Jul 16, 2024 · 3 comments
Open

impact of infinite loops on sanitizers #99010

bi6c opened this issue Jul 16, 2024 · 3 comments
Labels
compiler-rt:asan Address sanitizer compiler-rt:ubsan Undefined behavior sanitizer llvm:optimizations question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@bi6c
Copy link

bi6c commented Jul 16, 2024

Hello.
I have a question regarding the behavior of UBSAN and ASAN in the presence of infinite loops in C programs.
Do infinite loops affect the ability of UBSAN and ASAN to detect and report issues? (with compiler optimization -O1, -O2,...)

@nikic
Copy link
Contributor

nikic commented Jul 16, 2024

It's not super clear what you're asking here, but infinite loops affect sanitizers just like everything else does. If an infinite loop and its preceding code is optimized away prior to sanitizer instrumentation, then it won't be instrumented...

@bi6c
Copy link
Author

bi6c commented Jul 16, 2024

I found this case that UBSAN reported load of misaligned address error when compiling with clang-17 at -O2, but clang-19-init (trunk) does not report. It also happened when the optimization level is at -O3.
https://godbolt.org/z/cex4qMYe8

@EugeneZelenko EugeneZelenko added question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! compiler-rt:asan Address sanitizer compiler-rt:ubsan Undefined behavior sanitizer llvm:optimizations and removed new issue labels Jul 16, 2024
@bi6c
Copy link
Author

bi6c commented Jul 18, 2024

Sorry I might paste the wrong link. Here is the updated link: https://godbolt.org/z/cex4qMYe8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:asan Address sanitizer compiler-rt:ubsan Undefined behavior sanitizer llvm:optimizations question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

3 participants