[PATCH] D15996: Avoid undefined behavior in LinkAllPasses.h
Dimitry Andric via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 11 12:09:22 PST 2016
dim updated this revision to Diff 44533.
dim added a subscriber: jroelofs.
dim added a comment.
Since @jroelofs reminded me that 1 is maybe not such a good idea for a
pointer, let's use a stack-allocated object instead. Since `RGM` (a
`RGPassManager` object) was already there, we might as well use it.
http://reviews.llvm.org/D15996
Files:
include/llvm/LinkAllPasses.h
Index: include/llvm/LinkAllPasses.h
===================================================================
--- include/llvm/LinkAllPasses.h
+++ include/llvm/LinkAllPasses.h
@@ -186,9 +186,9 @@
(void)new llvm::IntervalPartition();
(void)new llvm::ScalarEvolutionWrapperPass();
- ((llvm::Function*)nullptr)->viewCFGOnly();
llvm::RGPassManager RGM;
- ((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);
+ ((llvm::Function*)&RGM)->viewCFGOnly();
+ ((llvm::RegionPass*)&RGM)->runOnRegion((llvm::Region*)nullptr, RGM);
llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)nullptr);
X.add(nullptr, 0, llvm::AAMDNodes()); // for -print-alias-sets
(void) llvm::AreStatisticsEnabled();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15996.44533.patch
Type: text/x-patch
Size: 751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160111/10bb9e76/attachment.bin>
More information about the llvm-commits
mailing list