This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix crash "-target arm -mcpu=generic", without "-march="
ClosedPublic

Authored by vsukharev on Sep 21 2015, 5:40 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

vsukharev updated this revision to Diff 35234.Sep 21 2015, 5:40 AM
vsukharev retitled this revision from to Fix crash "-target arm -mcpu=generic", without "-march=".
vsukharev updated this object.
vsukharev added a reviewer: rengolin.
vsukharev set the repository for this revision to rL LLVM.
vsukharev added a subscriber: cfe-commits.
vsukharev retitled this revision from Fix crash "-target arm -mcpu=generic", without "-march=" to [ARM ]Fix crash "-target arm -mcpu=generic", without "-march=".
vsukharev retitled this revision from [ARM ]Fix crash "-target arm -mcpu=generic", without "-march=" to [ARM] Fix crash "-target arm -mcpu=generic", without "-march=".
rengolin edited edge metadata.Sep 21 2015, 9:33 AM

Hi Vladmir,

Can you explain what the crash was?

cheers,
--renato

Yes, trying to pass new tests in test/Driver/arm-cortex-cpus.c, without code patch, it crashes

$ clang --target=arm-linux-gnueabi -mcpu=generic hello.c
/work/oss_llvm/llvm/include/llvm/ADT/StringRef.h:84: llvm::StringRef::StringRef(const char*, size_t): Assertion `(data || length == 0) && "StringRef cannot be built from a NULL argument with non-null length"' failed.
...
#9 0x2b22f25 (anonymous namespace)::._115::getSubArch() const lib/Support/TargetParser.cpp:74:0
#10 0x2b27147 llvm::ARM::getSubArch(unsigned int) lib/Support/TargetParser.cpp:309:0
#11 0x31871a1 clang::driver::tools::arm::getLLVMArchSuffixForARM(llvm::StringRef, llvm::StringRef) tools/clang/lib/Driver/Tools.cpp:6374:0
#12 0x3125da8 clang::driver::ToolChain::ComputeLLVMTriple(llvm::opt::ArgList const&, clang::driver::types::ID) const tools/clang/lib/Driver/ToolChain.cpp:321:0
#13 0x312656c clang::driver::ToolChain::ComputeEffectiveClangTriple(llvm::opt::ArgList const&, clang::driver::types::ID) const tools/clang/lib/Driver/ToolChain.cpp:353:0
#14 0x31726b1 clang::driver::tools::Clang::ConstructJob(clang::driver::Compilation&, clang::driver::JobAction const&, clang::driver::InputInfo const&, llvm::SmallVector<clang::driver::InputInfo, 4u> const&, llvm::opt::ArgList const&, char const*) const tools/clang/lib/Driver/Tools.cpp:3363:0
rengolin accepted this revision.Sep 22 2015, 2:43 PM
rengolin edited edge metadata.

Apart from the style nitpick, LGTM. Thanks!

lib/Driver/Tools.cpp
6139

Please, add curly brackets here for the else case.

This revision is now accepted and ready to land.Sep 22 2015, 2:43 PM
This revision was automatically updated to reflect the committed changes.