https://llvm.org/bugs/show_bug.cgi?id=26839
Bug ID: 26839 Summary: Clang -cc1 crashes if an unknown -target-cpu is passed for -triple arm Product: clang Version: 3.8 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: david.cab+llvm...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Steps to Reproduce: touch main.c clang -cc1 -triple arm -target-cpu xyz main.c -emit-obj Actual Results: The application crashed. $ ./clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang -cc1 -triple arm -target-cpu xyz main.c -emit-obj #0 0x0000000001594268 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x1594268) #1 0x00000000015948e7 SignalHandler(int) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x15948e7) #2 0x00007f8c41763d10 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10d10) #3 0x00007f8c40a3c8f0 /build/glibc-ryFjv0/glibc-2.21/string/../sysdeps/x86_64/multiarch/memcmp-sse4.S:878:0 #4 0x000000000156bff2 llvm::ARM::getCanonicalArchName(llvm::StringRef) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x156bff2) #5 0x000000000156cc76 llvm::ARM::parseArchProfile(llvm::StringRef) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x156cc76) #6 0x0000000002965a77 (anonymous namespace)::ARMTargetInfo::setArchInfo(unsigned int) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x2965a77) #7 0x0000000002962973 (anonymous namespace)::ARMTargetInfo::setCPU(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x2962973) #8 0x0000000002957183 clang::TargetInfo::CreateTargetInfo(clang::DiagnosticsEngine&, std::shared_ptr<clang::TargetOptions> const&) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x2957183) #9 0x000000000193056d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x193056d) #10 0x00000000019d9b0f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x19d9b0f) #11 0x0000000000742b9d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x742b9d) #12 0x0000000000741ed1 main (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x741ed1) #13 0x00007f8c408eea40 __libc_start_main /build/glibc-ryFjv0/glibc-2.21/csu/libc-start.c:323:0 #14 0x000000000073eeb9 _start (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x73eeb9) Stack dump: 0. Program arguments: ./clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang -cc1 -triple arm -target-cpu xyz main.c -emit-obj Segmentation fault (core dumped) Expected results: No crash and print an error message. Build Date & Platform: Clang 3.8.0-rc3 prebuilt binaries for Ubuntu 15.10 available at llvm.org. Additional Information: This is a regression with respect to clang 3.7.1. Using clang 3.7.1 results in normal behaviour. $ ./clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-15.10/bin/clang -cc1 -triple arm -target-cpu xyz main.c -emit-obj 'xyz' is not a recognized processor for this target (ignoring processor) [repeats 13 times] $ ./clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-15.10/bin/clang -cc1 -target-cpu xyz main.c -emit-obj error: unknown target CPU 'xyz' With clang 3.8.0-rc3 the results are expected for x86-64 but a crash for -triple arm. $ ./clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang -cc1 -target-cpu xyz main.c -emit-obj error: unknown target CPU 'xyz' $ ./clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang -cc1 -triple arm -target-cpu xyz main.c -emit-obj #0 0x0000000001594268 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/score/clang+llvm-3.8.0-rc3-x86_64-linux-gnu-ubuntu-15.10/bin/clang-3.8+0x1594268) [...] -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs