diff options
| author | Dimitry Andric <dimitry@andric.com> | 2016-01-13 18:29:46 +0000 |
|---|---|---|
| committer | Dimitry Andric <dimitry@andric.com> | 2016-01-13 18:29:46 +0000 |
| commit | 972e2c0cfbb2c880c67164a5897ea9501486a5ea (patch) | |
| tree | 83fa6b32bc3c0028d07e209fb0df0ab7fc204632 /llvm/lib/Analysis/Delinearization.cpp | |
| parent | 744959b9c9d7700a567926a4829f2e8cc6dc3cec (diff) | |
| download | bcm5719-llvm-972e2c0cfbb2c880c67164a5897ea9501486a5ea.tar.gz bcm5719-llvm-972e2c0cfbb2c880c67164a5897ea9501486a5ea.zip | |
Avoid undefined behavior in LinkAllPasses.h
The LinkAllPasses.h file is included in several main programs, to force
a large number of passes to be linked in. However, the ForcePassLinking
constructor uses undefined behavior, since it calls member functions on
`nullptr`, e.g.:
((llvm::Function*)nullptr)->viewCFGOnly();
llvm::RGPassManager RGM;
((llvm::RegionPass*)nullptr)->runOnRegion((llvm::Region*)nullptr, RGM);
When the optimization level is -O2 or higher, the code below the first
nullptr dereference is optimized away, and replaced by `ud2` (on x86).
Therefore, the calls after that first dereference are never emitted. In
my case, I noticed there was no call to `llvm::sys::RunningOnValgrind()`!
Replace instances of dereferencing `nullptr` with either objects on the
stack, or regular function calls.
Differential Revision: http://reviews.llvm.org/D15996
llvm-svn: 257645
Diffstat (limited to 'llvm/lib/Analysis/Delinearization.cpp')
0 files changed, 0 insertions, 0 deletions

