Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13.0.0-rc4: Assertion `getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())' failed. #51329

Closed
berolinux opened this issue Sep 27, 2021 · 5 comments
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate

Comments

@berolinux
Copy link

Bugzilla Link 51987
Resolution DUPLICATE
Resolved on Oct 14, 2021 17:35
Version trunk
OS Linux
Blocks #50580 #51489
Attachments reduced test case
CC @mizvekov,@tstellar

Extended Description

clang 13.0.0-rc4 crashes with "Assertion `getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())' failed." on this sample code:

$ cat bug.ii
class a {
public:
a();
a(a &);
a(int);
template operator b();
};
a c() {
if (0)
return a();
a d;
return d;
}

$ clang++ bug.ii
clang-13: /builddir/build/BUILD/llvm-project-release-13.x/clang/lib/CodeGen/CGExprCXX.cpp:616: void clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(const clang::CXXConstructExpr *, clang::CodeGen::AggValueSlot): Assertion `getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang-13 -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name bug.ii -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/bero/abf/exiv2/BUILD/exiv2-0.27.4-Source/build -resource-dir /usr/lib64/clang/13.0.0 -fdeprecated-macro -fdebug-compilation-dir=/home/bero/abf/exiv2/BUILD/exiv2-0.27.4-Source/build -ferror-limit 19 -fgnuc-version=11.1.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/bug-aa57d4.o -x c++-cpp-output bug.ii

  1.  <eof> parser at end of file
    
  2.  bug.ii:8:3: LLVM IR generation of declaration 'c'
    
  3.  bug.ii:8:3: Generating code for declaration 'c'
    

#​0 0x00007f9924a99271 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib64/libLLVMSupport.so.13+0x23b271)
#​1 0x00007f9924a9954d (/usr/lib64/libLLVMSupport.so.13+0x23b54d)
#​2 0x00007f9924a96e2a llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVMSupport.so.13+0x238e2a)
#​3 0x00007f9924a99866 (/usr/lib64/libLLVMSupport.so.13+0x23b866)
#​4 0x00007f9924459790 (/lib64/libc.so.6+0x45790)
#​5 0x00007f99244ade33 pthread_kill (/lib64/libc.so.6+0x99e33)
#​6 0x00007f99244596e2 gsignal (/lib64/libc.so.6+0x456e2)
#​7 0x00007f992444044b abort (/lib64/libc.so.6+0x2c44b)
#​8 0x00007f9924440377 (/lib64/libc.so.6+0x2c377)
#​9 0x00007f99244510f2 (/lib64/libc.so.6+0x3d0f2)
#​10 0x00007f99288bf0c2 clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(clang::CXXConstructExpr const*, clang::CodeGen::AggValueSlot) (/usr/lib64/libclangCodeGen.so.13+0x4890c2)
#​11 0x00007f99288b3026 (/usr/lib64/libclangCodeGen.so.13+0x47d026)
#​12 0x00007f99288b0737 (/usr/lib64/libclangCodeGen.so.13+0x47a737)
#​13 0x00007f99288aeb56 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/usr/lib64/libclangCodeGen.so.13+0x478b56)
#​14 0x00007f9928a1933a clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/usr/lib64/libclangCodeGen.so.13+0x5e333a)
#​15 0x00007f9928a16048 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/usr/lib64/libclangCodeGen.so.13+0x5e0048)
#​16 0x00007f9928a21b30 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/lib64/libclangCodeGen.so.13+0x5ebb30)
#​17 0x00007f9928a8db94 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/usr/lib64/libclangCodeGen.so.13+0x657b94)
#​18 0x00007f9928a8e7d9 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib64/libclangCodeGen.so.13+0x6587d9)
#​19 0x00007f9928ab2f9f clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib64/libclangCodeGen.so.13+0x67cf9f)
#​20 0x00007f9928aa941d clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib64/libclangCodeGen.so.13+0x67341d)
#​21 0x00007f9928aadf42 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/usr/lib64/libclangCodeGen.so.13+0x677f42)
#​22 0x00007f9928ab73cb clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/usr/lib64/libclangCodeGen.so.13+0x6813cb)
#​23 0x00007f9928b55a9f (/usr/lib64/libclangCodeGen.so.13+0x71fa9f)
#​24 0x00007f9928a80497 (/usr/lib64/libclangCodeGen.so.13+0x64a497)
#​25 0x00007f9922244274 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib64/libclangParse.so.13+0x6e274)
#​26 0x00007f9926bbf9af clang::ASTFrontendAction::ExecuteAction() (/usr/lib64/libclangFrontend.so.13+0x1bf9af)
#​27 0x00007f9928a7b173 clang::CodeGenAction::ExecuteAction() (/usr/lib64/libclangCodeGen.so.13+0x645173)
#​28 0x00007f9926bbf0a4 clang::FrontendAction::Execute() (/usr/lib64/libclangFrontend.so.13+0x1bf0a4)
#​29 0x00007f9926b15caf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib64/libclangFrontend.so.13+0x115caf)
#​30 0x00007f992984dce6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclangFrontendTool.so.13+0x5ce6)
#​31 0x00000000002196fe cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-13+0x2196fe)
#​32 0x0000000000216e60 (/usr/bin/clang-13+0x216e60)
#​33 0x00000000002165a3 main (/usr/bin/clang-13+0x2165a3)
#​34 0x00007f9924441d8c (/lib64/libc.so.6+0x2dd8c)
#​35 0x00007f9924441e39 __libc_start_main (/lib64/libc.so.6+0x2de39)
#​36 0x0000000000212c41 _start (/usr/bin/clang-13+0x212c41)
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see invocation)
OpenMandriva 13.0.0-0.20210922.2 clang version 13.0.0 (/builddir/build/BUILD/llvm-project-release-13.x/clang 11a6bc2c1059bc4d0d8641bf23ed6dcd5e2b1b66)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-13: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

This is a regression from 12.0.x.

@berolinux
Copy link
Author

test case is extracted from exiv2 0.27.4.

@slacka
Copy link
Mannequin

slacka mannequin commented Sep 28, 2021

Can we get a bisect on this?

@berolinux
Copy link
Author

[7d2d5a3] [clang] Apply P1825 as Defect Report from C++11 up to C++20.

@mizvekov
Copy link
Contributor

Already fixed in trunk, and the fix has been cherry-picked for the latest 13 release candidate.

*** This bug has been marked as a duplicate of bug llvm/llvm-bugzilla-archive#51862 ***

@tstellar
Copy link
Collaborator

mentioned in issue #51489

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

3 participants