dblaikie added a comment.

In D146466#4218011 <https://reviews.llvm.org/D146466#4218011>, @efriedma wrote:

> I think the reason "recoverable" ubsan causes trouble is that it introduces 
> branches that subsequent optimizations can abuse.  So without ubsan, we just 
> have an udiv instruction.  With ubsan, we conveniently have a branch on 
> exactly the condition that would make the udiv undefined, so we can easily 
> prove control flow doesn't continue after the ubsan handler.  Subsequent 
> optimizations take advantage of that, so ubsan "breaks" code.  (So the code 
> was never actually correct according to the semantic model, but it was broken 
> in a way the compiler is less likely optimize.)

Ah, interesting - thanks for the explanation!

(but, yeah, not sure we can/should provide any further guarantees beyond "does 
/something/ after the sanitizer failure... " don't get stronger guarantees than 
without the sanitizer & while worth documenting that the sanitizer could make 
the problems after "recovery" worse than without the sanitizer enabled)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146466/new/

https://reviews.llvm.org/D146466

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to