-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
I'm having trouble compiling the xsimd library (https://github.com/xtensor-stack/xsimd) with Clang. I've reproduced the issue in my codebase both on Linux (Ubuntu Clang version 15.0.7) and macOS (Apple Clang version 14.0.3 (clang-1403.0.22.14.1)).
Interesting enough on macOS I get the segfault only on Apple Silicon, not on an Intel machine, although it was segfaulting on the Intel machine with the previous version of XCode.
I've manage to create a minimum example, and narrowed down the issue to enabling the warning -Wcast-align
(i.e. with the warning enabled I get a segfault during compilation, with the warning disabled the code compiles and runs fine). The code compiles and runs fine in GCC.
Here's the stack trace:
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang++ -I/home/momchil/Desktop/AVxtensor/src -I/home/momchil/Desktop/AVxtensor/externals/xsimd/include -g -Wcast-align -std=gnu++20 -MD -MT CMakeFiles/ExampleProblemProject.dir/src/ExampleProblem.cpp.o -MF CMakeFiles/ExampleProblemProject.dir/src/ExampleProblem.cpp.o.d -o CMakeFiles/ExampleProblemProject.dir/src/ExampleProblem.cpp.o -c /home/momchil/Desktop/AVxtensor/src/ExampleProblem.cpp
1. /home/momchil/Desktop/AVxtensor/externals/xsimd/include/xsimd/arch/./xsimd_sse2.hpp:672:77: current parser token ')'
2. /home/momchil/Desktop/AVxtensor/externals/xsimd/include/xsimd/arch/./xsimd_sse2.hpp:21:1: parsing namespace 'xsimd'
3. /home/momchil/Desktop/AVxtensor/externals/xsimd/include/xsimd/arch/./xsimd_sse2.hpp:32:5: parsing namespace 'xsimd::kernel'
4. /home/momchil/Desktop/AVxtensor/externals/xsimd/include/xsimd/arch/./xsimd_sse2.hpp:652:9: parsing function body 'xsimd::kernel::from_mask'
5. /home/momchil/Desktop/AVxtensor/externals/xsimd/include/xsimd/arch/./xsimd_sse2.hpp:652:9: in compound statement ('{}')
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x31)[0x7fc0c4b07281]
/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x7fc0c4b04f9e]
/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0x101)[0x7fc0c4b06641]
/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1(+0xe2954f)[0x7fc0c4a2954f]
/lib/x86_64-linux-gnu/libc.so.6(+0x3bcf0)[0x7fc0c343bcf0]
/lib/x86_64-linux-gnu/libc.so.6(+0x171b81)[0x7fc0c3571b81]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang4Expr21EvaluateKnownConstIntERKNS_10ASTContextEPN4llvm15SmallVectorImplISt4pairINS_14SourceLocationENS_17PartialDiagnosticEEEE+0x277)[0x7fc0cbb794b7]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang11AlignedAttr12getAlignmentERNS_10ASTContextE+0x3a)[0x7fc0cba4f10a]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang4Decl15getMaxAlignmentEv+0x1b7)[0x7fc0cbaffa17]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang10ASTContext12getDeclAlignEPKNS_4DeclEb+0x1e)[0x7fc0cb973e1e]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x12844ed)[0x7fc0cc0844ed]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x12841a8)[0x7fc0cc0841a8]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x12848fe)[0x7fc0cc0848fe]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x12846a8)[0x7fc0cc0846a8]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x12841a8)[0x7fc0cc0841a8]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x1268c0c)[0x7fc0cc068c0c]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang4Sema14CheckCastAlignEPNS_4ExprENS_8QualTypeENS_11SourceRangeE+0x130)[0x7fc0cc068b10]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x123d1f2)[0x7fc0cc03d1f2]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang4Sema19BuildCStyleCastExprENS_14SourceLocationEPNS_14TypeSourceInfoES1_PNS_4ExprE+0x12d)[0x7fc0cc03ac4d]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang4Sema13ActOnCastExprEPNS_5ScopeENS_14SourceLocationERNS_10DeclaratorERNS_9OpaquePtrINS_8QualTypeEEES3_PNS_4ExprE+0x31f)[0x7fc0cc27a2cf]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser20ParseParenExpressionERNS0_16ParenParseOptionEbbRNS_9OpaquePtrINS_8QualTypeEEERNS_14SourceLocationE+0x1628)[0x7fc0cb8db838]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseCastExpressionENS0_13CastParseKindEbRbNS0_13TypeCastStateEbPb+0x17ee)[0x7fc0cb8d885e]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser25ParseAssignmentExpressionENS0_13TypeCastStateE+0xe1)[0x7fc0cb8d3091]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseExpressionListERN4llvm15SmallVectorImplIPNS_4ExprEEERNS2_INS_14SourceLocationEEENS1_12function_refIFvvEEEbb+0x10a)[0x7fc0cb8df03a]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser28ParsePostfixExpressionSuffixENS_12ActionResultIPNS_4ExprELb1EEE+0x14f4)[0x7fc0cb8d60b4]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseCastExpressionENS0_13CastParseKindEbRbNS0_13TypeCastStateEbPb+0xdf)[0x7fc0cb8d714f]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser25ParseAssignmentExpressionENS0_13TypeCastStateE+0xe1)[0x7fc0cb8d3091]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseExpressionListERN4llvm15SmallVectorImplIPNS_4ExprEEERNS2_INS_14SourceLocationEEENS1_12function_refIFvvEEEbb+0x10a)[0x7fc0cb8df03a]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser28ParsePostfixExpressionSuffixENS_12ActionResultIPNS_4ExprELb1EEE+0x14f4)[0x7fc0cb8d60b4]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseCastExpressionENS0_13CastParseKindEbRbNS0_13TypeCastStateEbPb+0xdf)[0x7fc0cb8d714f]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser25ParseAssignmentExpressionENS0_13TypeCastStateE+0xe1)[0x7fc0cb8d3091]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser15ParseExpressionENS0_13TypeCastStateE+0x9)[0x7fc0cb8d2f99]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser20ParseReturnStatementEv+0x107)[0x7fc0cb936d97]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser42ParseStatementOrDeclarationAfterAttributesERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_17ParsedStmtContextEPNS_14SourceLocationERNS_16ParsedAttributesESB_+0xa0d)[0x7fc0cb930bdd]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser27ParseStatementOrDeclarationERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_17ParsedStmtContextEPNS_14SourceLocationE+0x15f)[0x7fc0cb92ffbf]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser26ParseCompoundStatementBodyEb+0x7a0)[0x7fc0cb938c90]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser26ParseFunctionStatementBodyEPNS_4DeclERNS0_10ParseScopeE+0xb5)[0x7fc0cb939cc5]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser23ParseFunctionDefinitionERNS_17ParsingDeclaratorERKNS0_18ParsedTemplateInfoEPNS0_18LateParsedAttrListE+0xe12)[0x7fc0cb953ec2]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser35ParseSingleDeclarationAfterTemplateENS_17DeclaratorContextERKNS0_18ParsedTemplateInfoERNS_21ParsingDeclRAIIObjectERNS_14SourceLocationERNS_16ParsedAttributesENS_15AccessSpecifierE+0x1043)[0x7fc0cb942273]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser40ParseTemplateDeclarationOrSpecializationENS_17DeclaratorContextERNS_14SourceLocationERNS_16ParsedAttributesENS_15AccessSpecifierE+0x512)[0x7fc0cb9408c2]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser36ParseDeclarationStartingWithTemplateENS_17DeclaratorContextERNS_14SourceLocationERNS_16ParsedAttributesENS_15AccessSpecifierE+0xdc)[0x7fc0cb94023c]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser16ParseDeclarationENS_17DeclaratorContextERNS_14SourceLocationERNS_16ParsedAttributesES5_PS2_+0x1c5)[0x7fc0cb8a1cd5]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser24ParseExternalDeclarationERNS_16ParsedAttributesEPNS_15ParsingDeclSpecE+0x11b)[0x7fc0cb95157b]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseInnerNamespaceERKN4llvm11SmallVectorINS0_18InnerNamespaceInfoELj4EEEjRNS_14SourceLocationERNS_16ParsedAttributesERNS_24BalancedDelimiterTrackerE+0xd2)[0x7fc0cb8bcd72]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser14ParseNamespaceENS_17DeclaratorContextERNS_14SourceLocationES2_+0x12e6)[0x7fc0cb8bc6b6]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser16ParseDeclarationENS_17DeclaratorContextERNS_14SourceLocationERNS_16ParsedAttributesES5_PS2_+0x3c7)[0x7fc0cb8a1ed7]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser24ParseExternalDeclarationERNS_16ParsedAttributesEPNS_15ParsingDeclSpecE+0x11b)[0x7fc0cb95157b]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser19ParseInnerNamespaceERKN4llvm11SmallVectorINS0_18InnerNamespaceInfoELj4EEEjRNS_14SourceLocationERNS_16ParsedAttributesERNS_24BalancedDelimiterTrackerE+0xd2)[0x7fc0cb8bcd72]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser14ParseNamespaceENS_17DeclaratorContextERNS_14SourceLocationES2_+0x12e6)[0x7fc0cb8bc6b6]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser16ParseDeclarationENS_17DeclaratorContextERNS_14SourceLocationERNS_16ParsedAttributesES5_PS2_+0x3c7)[0x7fc0cb8a1ed7]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser24ParseExternalDeclarationERNS_16ParsedAttributesEPNS_15ParsingDeclSpecE+0x11b)[0x7fc0cb95157b]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6Parser17ParseTopLevelDeclERNS_9OpaquePtrINS_12DeclGroupRefEEERNS_4Sema17ModuleImportStateE+0x453)[0x7fc0cb94ff33]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang8ParseASTERNS_4SemaEbb+0x2ee)[0x7fc0cb88e82e]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang13CodeGenAction13ExecuteActionEv+0xd5)[0x7fc0cca81785]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang14FrontendAction7ExecuteEv+0x67)[0x7fc0cd4be4b7]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x336)[0x7fc0cd42f606]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x29a)[0x7fc0cd53ca6a]
/usr/bin/clang++(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x968)[0x55c345685598]
/usr/bin/clang++(+0x1169b)[0x55c34568369b]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(+0x228fbd2)[0x7fc0cd08fbd2]
/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xde)[0x7fc0c4a292ae]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x138)[0x7fc0cd08f6a8]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_b+0x44a)[0x7fc0cd05171a]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEEb+0x8e)[0x7fc0cd05196e]
/usr/lib/llvm-15/bin/../lib/libclang-cpp.so.15(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x39f)[0x7fc0cd06e99f]
/usr/bin/clang++(_Z10clang_mainiPPc+0x27ef)[0x55c345682e1f]
/lib/x86_64-linux-gnu/libc.so.6(+0x23510)[0x7fc0c3423510]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x89)[0x7fc0c34235c9]
/usr/bin/clang++(_start+0x25)[0x55c3456802e5]
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/ExampleProblem-999383.cpp
clang: note: diagnostic msg: /tmp/ExampleProblem-999383.sh
clang: note: diagnostic msg:
********************
I'm attaching the Clang generated preprocessed file and compile script, as well as a zip of a minimum example CMake project to repro.