dcoughlin added a comment.

Here is the discussion on cfe-dev. 
http://lists.llvm.org/pipermail/cfe-dev/2016-September/050800.html
What's going on is that the path-sensitive unreachable code checker traverses 
blocks in the unoptimized CFG and emits a diagnostic if a block in that CFG is 
not reachable. But it decides whether a block is reachable by using the 
exploded node graph, which itself refers to the *optimized* CFG.

Normally this isn't a problem because the difference between the unoptimized 
and optimized CFGs is that the latter prunes edges that are trivially false 
(but the two CFGs have the same blocks). Unfortunately, there is a bug in CFG 
construction for do-while loops that also prunes a block. Since the block ids 
are constructed sequentially, the block IDs between the two CFGs don't match up 
and so the unreachable code checker gets confused.

I think the best fix here is to change construction of the optimized CFG to not 
prune the block in VisitDoStmt(). This matches what I think is the expected 
meaning of the 'PruneTriviallyFalseEdges' CFG option.


https://reviews.llvm.org/D24759



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

Reply via email to