[PATCH] D56899: [analyzer] pr37688: Fix a crash on trying to evaluate a deleted destructor of a union.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 17 20:21:47 PST 2019


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, rnkovacs, mikhail.ramalho, Szelethus, baloghadamsoftware.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, szepet.

This is a slow quick fix for https://bugs.llvm.org/show_bug.cgi?id=37688 - add a defensive check against an invalid destructor in the CFG.

Unions with fields with destructors have their own destructor implicitly deleted. Due to a bug in the CFG we're still trying to evaluate them at the end of the object's lifetime and crash because we are unable to find the declaration.

Add a FIXME test for the CFG that demonstrates the bug and a normal test that demonstrates that we've fixed the crash and are even trying to continue the analysis beyond that point.

I've no idea why did this require a noexcept specification. I also don't know why does it require that many levels of structure nestedness; it might be that Clang doesn't emit an error in this case but in fact the code is invalid - an error about attempting to rely upon a deleted destructor is emitted in many simpler cases.


Repository:
  rC Clang

https://reviews.llvm.org/D56899

Files:
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  test/Analysis/cfg.cpp
  test/Analysis/unions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56899.182453.patch
Type: text/x-patch
Size: 3850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/0bb4f254/attachment.bin>


More information about the cfe-commits mailing list