[cfe-dev] Clang 7.1.0 crashing in emitMultiVersionFunctions

Riyaz Puthiyapurayil via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 11 12:23:14 PDT 2019


Hi Everyone,

Anyone knows if this is a known bug that has been fixed?

Crash occurs with my clang 7.1.0 build but not with the trunk builds at (wandbox, godbolt):

Test case:


#include <nmmintrin.h>



class Foo {

   __attribute__((target("default"))) void lexString() { }



   __attribute__((target("sse4.2"))) void lexString() {

      static const char whitespaces[16] = " \t\r\n";

      const __m128i w = _mm_loadu_si128((__m128i *)whitespaces);

   }

};

Stack trace:
#0  0x00002aaaabedd495 in raise () from /lib64/libc.so.6
#1  0x00002aaaabedec75 in abort () from /lib64/libc.so.6
#2  0x00002aaaac25093d in uw_update_context_1 (context=context at entry=0x3bcb6d0, fs=fs at entry=0x3bcb7c0)
    at ../../../src/gcc-6.2.0/libgcc/unwind-dw2.c:1426
#3  0x00002aaaac250c91 in uw_update_context (context=context at entry=0x3bcb6d0, fs=fs at entry=0x3bcb7c0)
    at ../../../src/gcc-6.2.0/libgcc/unwind-dw2.c:1502
#4  0x00002aaaac2513ed in _Unwind_Backtrace (trace=0x2aaaabfa9a30 <backtrace_helper>, trace_argument=0x3bcb980)
    at ../../../src/gcc-6.2.0/libgcc/unwind.inc:303
#5  0x00002aaaabfa9bc6 in backtrace () from /lib64/libc.so.6
#6  0x0000000001271b0d in PrintStackTraceSignalHandler(void*) ()
#7  0x000000000126fa3e in llvm::sys::RunSignalHandlers() ()
#8  0x0000000001271c82 in SignalHandler(int) ()
#9  <signal handler called>
#10 0x0000000000eb4850 in llvm::Value::getName() const ()
#11 0x000000000147c3f0 in clang::CodeGen::CodeGenModule::emitMultiVersionFunctions() ()
#12 0x000000000147b789 in clang::CodeGen::CodeGenModule::Release() ()
#13 0x0000000001b165e4 in (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ()
#14 0x0000000001b13c58 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) ()
#15 0x0000000002288cf5 in clang::ParseAST(clang::Sema&, bool, bool) ()
#16 0x000000000181d48c in clang::FrontendAction::Execute() ()
#17 0x00000000017cbc58 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#18 0x00000000018adbc9 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#19 0x00000000007b9ae7 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ()
#20 0x00000000007b7c67 in main ()

The crash goes away if static const char whitespaces[16] is changed to const char whitespaces[16] by removing the static keyword.

/Riyaz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190611/d2b0a5ad/attachment.html>


More information about the cfe-dev mailing list