[llvm-bugs] [Bug 51862] New: [clang] After 7d2d5a3a6d7, Assertion failed: (getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())), function EmitCXXConstructExpr, file clang/lib/CodeGen/CGExprCXX.cpp, line 616

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 14 13:27:48 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51862

            Bug ID: 51862
           Summary: [clang] After 7d2d5a3a6d7, Assertion failed:
                    (getContext().hasSameUnqualifiedType(E->getType(),
                    E->getArg(0)->getType())), function
                    EmitCXXConstructExpr, file
                    clang/lib/CodeGen/CGExprCXX.cpp, line 616
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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 at 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=<optimized out>, file=<optimized out>,
line=<optimized out>, failedexpr=<optimized out>) 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
https://github.com/llvm/llvm-project/commit/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 <class b> operator b();
};
a c() {
  if (0) {
    a e;
    return e;
  }
  a d;
  return d;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210914/dc4c7650/attachment-0001.html>


More information about the llvm-bugs mailing list