[PATCH] D40073: [Analyzer] Non-determinism: don't sort indirect goto LabelDecl's by addresses

Ilya Palachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 05:13:53 PST 2017


ilya-palachev created this revision.
Herald added subscribers: szepet, xazax.hun.

Current CFG is built in non-deterministic order due to the fact that indirect goto labels' declarations (LabelDecl's) are stored in the llvm::SmallSet container. LabelDecl's are pointers, whose order is not deterministic by design, and llvm::SmallSet sorts them by their non-deterministic addresses after "small" container is exceeded. This leads to non-deterministic processing of the elements of the
container.

The fix is to use llvm::SmallSetVector, which is deterministic by design.

The introduced test case was creduce'd from Android5 source file.

The test file contains 100 runs, in order to make the testing stable: different PLIST's are generated in 20% and 80% cases, correspondingly.


Repository:
  rL LLVM

https://reviews.llvm.org/D40073

Files:
  lib/Analysis/CFG.cpp
  test/Analysis/diagnostics/goto-label-determinism.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40073.123014.patch
Type: text/x-patch
Size: 11306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171115/4f583562/attachment.bin>


More information about the cfe-commits mailing list