- Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 51862 |
| Resolution | FIXED |
| Resolved on | Sep 30, 2021 18:17 |
| Version | trunk |
| OS | All |
| Blocks | #50580 |
| CC | @aaronpuchert,@Quuxplusone,@berolinux,@DougGregor,@DimitryAndric,@emaste,@mizvekov,@zygoloid,@rjmccall,@tstellar |
| Fixed by commit(s) | d9308aa d7b669b |
Extended Description
While building the FreeBSD math/frobby port (see also https://doc.sagemath.org/html/en/reference/spkg/frobby.html ) with clang 13 as part of a large ports build, I encountered the following assertion:
Assertion failed: (getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())), function EmitCXXConstructExpr, file /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp, line 616.
Program received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:4
4 RSYSCALL(thr_kill)
(gdb) bt
#0 thr_kill () at thr_kill.S:4
#1 0x00000000066c15af in __raise (s=s@entry=6) at /share/dim/src/freebsd/llvm-13-update/lib/libc/gen/raise.c:52
#2 0x000000000672b0b9 in abort () at /share/dim/src/freebsd/llvm-13-update/lib/libc/stdlib/abort.c:67
#3 0x00000000066ac7ba in __assert (func=, file=, line=, failedexpr=) at /share/dim/src/freebsd/llvm-13-update/lib/libc/gen/assert.c:51
#4 0x0000000002ce4b94 in EmitCXXConstructExpr () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp:615
#5 0x0000000002ba8b43 in VisitCXXConstructExpr () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:1315
#6 0x0000000002ba4eb7 in Visit () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:107
#7 EmitAggExpr () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:1998
#8 0x0000000002b12837 in EmitReturnStmt () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:1291
#9 0x0000000002b0f0c9 in EmitStmt () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:152
#10 0x0000000002b19edc in EmitCompoundStmtWithoutScope () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:496
#11 0x0000000002afe87d in EmitFunctionBody () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1199
#12 0x0000000002aff3be in GenerateCode () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1373
#13 0x000000000267cf49 in EmitGlobalFunctionDefinition () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4861
#14 0x0000000002676656 in EmitGlobalDefinition () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3220
#15 0x000000000267a251 in EmitGlobal () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2982
#16 0x0000000002680332 in EmitTopLevelDecl () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5698
#17 0x00000000030f974f in HandleTopLevelDecl () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:170
#18 0x00000000030f6d86 in HandleTopLevelDecl () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:215
#19 0x00000000035cfce7 in ParseAST () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/Parse/ParseAST.cpp:162
#20 0x00000000030378bf in Execute () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp:951
#21 0x0000000002fc10bf in ExecuteAction () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:974
#22 0x00000000030f0d9b in ExecuteCompilerInvocation () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278
#23 0x0000000002615751 in cc1_main () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/tools/driver/cc1_main.cpp:246
#24 0x0000000002622d92 in ExecuteCC1Tool () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/tools/driver/driver.cpp:338
#25 0x0000000002622b80 in main () at /share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/tools/driver/driver.cpp:409
Bisection shows this to be a regression due to 7d2d5a3a6d7 ("[clang] Apply P1825 as Defect Report from C++11 up to C++20").
Reduced test case:
// clang -cc1 -triple x86_64-- -S IntersectFacade-min.cpp
struct a {
a();
a(a &);
a(int);
template operator b();
};
a c() {
if (0) {
a e;
return e;
}
a d;
return d;
}