[PATCH] D69962: [CFG] Fix a flaky crash in CFGBlock::getLastCondition().

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 8 14:34:39 PST 2019


NoQ marked an inline comment as done.
NoQ added a comment.

In D69962#1738618 <https://reviews.llvm.org/D69962#1738618>, @Szelethus wrote:

> Nice catch! Though, wouldn't the memory sanitizer buildbots break on this reliably?


I kinda hope so; i'll take a look at home.



================
Comment at: clang/lib/Analysis/CFG.cpp:5882
 
+  // FIXME: Should we return the terminator here?
+  if (size() == 0)
----------------
Szelethus wrote:
> What would that even be?
Dunno. Excellent question. I'm, like, curious if there's a better behavior we can implement.

Here's the CFG for the current test case:

{F10670002}

FIXME: It's not particularly obvious from the dump that `[B5.6]` is a `MaterializeTemporaryExpr`.

I can't say i'm a big fan of how it looks. The temp dtor branch (terminator of `[B4]`) is unnecessary here, given that the short circuit never happens. But that's our typical problems with how CFG cuts off unreachable branches but never canonicalizes itself after that.

One way or another, we were crashing when calling `getLastCondition()` for `[B2]`. Its terminator is the if-statement. It probably doesn't make much sense to return the if-statement, but the answer that you're looking for is most likely `[B4.1]` rather than `nullptr`.


Repository:
  rC Clang

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

https://reviews.llvm.org/D69962





More information about the cfe-commits mailing list