[PR] Adding CONTINUE strategy impl to DivByZero sanitizer - #248
Merged
Conversation
rjsmith1999
reviewed
Aug 20, 2026
added 7 commits
August 20, 2026 17:10
…ame to binaryInst.
… the divide by zero sanitizer.
…nd cleaning up some comments.
…_recover because they do not return. This can help LLVM optimize CFGs.
elazaro-riverside
force-pushed
the
adding-continue-to-div-by-zero
branch
from
August 20, 2026 21:11
ef6d233 to
7e7ee24
Compare
added 3 commits
August 20, 2026 17:13
…the largest floating point value from LLVM's point of view.
rjsmith1999
requested changes
Aug 25, 2026
| } | ||
| } | ||
|
|
||
| if (Ty->isFloatTy()) { |
Collaborator
There was a problem hiding this comment.
I think you want "isFloatingPointTy" not isFloatTy here
added 2 commits
August 25, 2026 10:29
…ered incompatible with this sanitizer. This also quiets clang-tidy complaint.
rjsmith1999
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains a change to the
ArithmeticSanitizer.cppsource file. The divide by zero sanitizer did not have an implementation for the CONTINUE remediation strategy. This PR attempts to fix this by creating a helper function to generate the correctINT_MAXconstant value for the operand type.Something to note is that the compiler-generated remediation strategies (EXIT, RECOVER, CONTINUE) have different control-flow behavior. RECOVER and EXIT transfer control to other processes thereby not resuming program execution. CONTINUE generates a constant and resumes program execution. At the IR level, we want to insert an
unreachableinstruction if the selected strategy is EXIT or RECOVER. Otherwise, we want to merge the constant value generated from the continue strategy back into the basic block to continue execution.To handle these cases, I modified the CFG-mutation logic to generate the correct control flow behavior based on the selected strategy.