Bug 245745

Summary: CURRENT clang crashes in poudriere building devel/simdjson
Product: Ports & Packages Reporter: Loïc Bartoletti <lbartoletti>
Component: Individual Port(s)Assignee: Dimitry Andric <dim>
Status: Closed FIXED    
Severity: Affects Some People CC: marklmi26-fbsd, toolchain
Priority: --- Flags: koobs: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245744
Attachments:
Description Flags
simdjson build log none

Description Loïc Bartoletti freebsd_committer freebsd_triage 2020-04-19 21:00:43 UTC
Created attachment 213575 [details]
simdjson build log

base clang crashes when building devel/simdjson on AMD Ryzen 7 3700X (but not on Intel(R) Core(TM) i7-7500U)

Log in attachement and 

Preprocessed source and associated run script at:
https://people.freebsd.org/~lbartoletti/simdjson-150d13.sh
https://people.freebsd.org/~lbartoletti/simdjson-150d13.cpp
Comment 1 Mark Millard 2020-04-20 07:41:57 UTC
(In reply to Loïc Bartoletti from comment #0)

I tried the .sh and .cpp on a ThreadRipper 1950X and got
the crash in my head -r359427 context. gdb reports:

(gdb) bt
#0  thr_kill () at thr_kill.S:4
#1  0x000000080531ff14 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000805293f66 in abort () at /usr/src/lib/libc/stdlib/abort.c:79
#3  0x000000080530e1e1 in __assert (func=<optimized out>, file=<optimized out>, line=<optimized out>, failedexpr=<optimized out>) at /usr/src/lib/libc/gen/assert.c:51
#4  0x0000000001969ee8 in Init () at /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h:45
#5  0x000000000296faa3 in GlobalDecl () at /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h:56
#6  checkTargetFeatures () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:2328
#7  0x0000000002b01d7f in EmitCall () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp:3841
#8  0x0000000002ad2546 in EmitCall () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:3618
#9  EmitCXXConstructorCall () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp:2160
#10 0x0000000002ad1c6b in EmitCXXConstructorCall () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp:2074
#11 0x0000000002a58637 in EmitCXXConstructExpr () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp:649
#12 0x0000000002a63a27 in Visit () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:43
#13 0x0000000002a6001a in Visit () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:106
#14 EmitAggExpr () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:1848
#15 0x0000000002ab20ea in EmitExprAsInit () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp:1902
#16 0x0000000002aaf785 in EmitAutoVarInit () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp:1842
#17 0x0000000002aab485 in EmitAutoVarDecl () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp:1283
#18 EmitVarDecl () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp:195
#19 0x0000000002aab0fc in EmitDecl () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp:139
#20 0x00000000029b242b in EmitDeclStmt () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:1151
#21 0x00000000029aa085 in EmitSimpleStmt () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:369
#22 0x00000000029a95a8 in EmitStmt () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:50
#23 0x00000000029b2f5c in EmitCompoundStmtWithoutScope () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:444
#24 0x000000000296b910 in EmitFunctionBody () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1146
#25 GenerateCode () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1311
#26 0x0000000002854a81 in EmitGlobalFunctionDefinition () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4467
#27 0x000000000284e378 in EmitGlobalDefinition () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2847
#28 0x0000000002857be9 in EmitTopLevelDecl () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5272
#29 0x000000000285b8cb in EmitDeclContext () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5258
#30 0x000000000285b8cb in EmitDeclContext () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5258
#31 0x00000000019d171f in HandleTopLevelDecl () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:170
#32 0x00000000019706c7 in HandleTopLevelDecl () at /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:214
#33 0x000000000265fa13 in ParseAST () at /usr/src/contrib/llvm-project/clang/lib/Parse/ParseAST.cpp:162
#34 0x0000000001f1874f in Execute () at /usr/src/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp:936
#35 0x000000000314da33 in ExecuteAction () at /usr/src/contrib/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:965
#36 0x0000000001931023 in ExecuteCompilerInvocation () at /usr/src/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290
#37 0x00000000019220a7 in cc1_main () at /usr/src/contrib/llvm-project/clang/tools/driver/cc1_main.cpp:240
#38 0x000000000192eaaf in ExecuteCC1Tool () at /usr/src/contrib/llvm-project/clang/tools/driver/driver.cpp:329
#39 0x000000000192e76e in main () at /usr/src/contrib/llvm-project/clang/tools/driver/driver.cpp:403

(gdb) up 4
#4  0x0000000001969ee8 in Init () at /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h:45
45	    assert(!isa<CXXConstructorDecl>(D) && "Use other ctor with ctor decls!");
(gdb) list
40	class GlobalDecl {
41	  llvm::PointerIntPair<const Decl *, 2> Value;
42	  unsigned MultiVersionIndex = 0;
43	
44	  void Init(const Decl *D) {
45	    assert(!isa<CXXConstructorDecl>(D) && "Use other ctor with ctor decls!");
46	    assert(!isa<CXXDestructorDecl>(D) && "Use other ctor with dtor decls!");
47	
48	    Value.setPointer(D);
49	  }
(gdb) up
#5  0x000000000296faa3 in GlobalDecl () at /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h:56
56	    Init(D);
. . .
(gdb) list -20
36	/// GlobalDecl - represents a global declaration. This can either be a
37	/// CXXConstructorDecl and the constructor type (Base, Complete).
38	/// a CXXDestructorDecl and the destructor type (Base, Complete) or
39	/// a VarDecl, a FunctionDecl or a BlockDecl.
40	class GlobalDecl {
41	  llvm::PointerIntPair<const Decl *, 2> Value;
42	  unsigned MultiVersionIndex = 0;
43	
44	  void Init(const Decl *D) {
45	    assert(!isa<CXXConstructorDecl>(D) && "Use other ctor with ctor decls!");
(gdb) 
46	    assert(!isa<CXXDestructorDecl>(D) && "Use other ctor with dtor decls!");
47	
48	    Value.setPointer(D);
49	  }
50	
51	public:
52	  GlobalDecl() = default;
53	  GlobalDecl(const VarDecl *D) { Init(D);}
54	  GlobalDecl(const FunctionDecl *D, unsigned MVIndex = 0)
55	      : MultiVersionIndex(MVIndex) {
(gdb) 
56	    Init(D);
57	  }
58	  GlobalDecl(const BlockDecl *D) { Init(D); }
59	  GlobalDecl(const CapturedDecl *D) { Init(D); }
60	  GlobalDecl(const ObjCMethodDecl *D) { Init(D); }
61	  GlobalDecl(const OMPDeclareReductionDecl *D) { Init(D); }
62	  GlobalDecl(const OMPDeclareMapperDecl *D) { Init(D); }
63	  GlobalDecl(const CXXConstructorDecl *D, CXXCtorType Type) : Value(D, Type) {}
64	  GlobalDecl(const CXXDestructorDecl *D, CXXDtorType Type) : Value(D, Type) {}
65	  GlobalDecl(const VarDecl *D, DynamicInitKind StubKind)

I do not have access to an Intel context to try.
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2020-04-20 12:16:31 UTC
Can you please retry after base r359826? That commit should fix this error too.
Comment 3 Loïc Bartoletti freebsd_committer freebsd_triage 2020-04-21 06:49:38 UTC
(In reply to Dimitry Andric from comment #2)

Yes, you're right. It builds well with the latest revision.
Thanks.
I'll close it, if it's ok for you.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2020-04-21 06:52:06 UTC
^Triage: 

- Correct resolution: resolved by a commit (FIXED)
- Assign to committer that resolved