Skip to content

Commit 4ea8569

Browse files
committed
[CPP-434] Squelch query alerts if ALL files were compiled
with `-fwrapv` or `-fno-strict-overflow`
1 parent 217ecd3 commit 4ea8569

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cpp/ql/src/Likely Bugs/Arithmetic/SignedOverflowCheck.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@ where
2323
globalValueNumber(expr1) = globalValueNumber(expr2) and
2424
add.getUnspecifiedType().(IntegralType).isSigned() and
2525
not exists(MacroInvocation mi | mi.getAnAffectedElement() = add) and
26-
exprMightOverflowPositively(add)
26+
exprMightOverflowPositively(add) and
27+
exists(Compilation c | c.getAFileCompiled() = ro.getFile() |
28+
not c.getAnArgument() = "-fwrapv" and
29+
not c.getAnArgument() = "-fno-strict-overflow"
30+
)
2731
select ro, "Testing for signed overflow may produce undefined results."

0 commit comments

Comments
 (0)