[llvm-bugs] [Bug 36638] [MS] clang fails to compile function with __unaligned argument to class member

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 7 16:16:57 PST 2018


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

Ilia Taraban <ilia.taraban at intel.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #5 from Ilia Taraban <ilia.taraban at intel.com> ---
After your commit now I have assert in FE on similar test:

=============== fine.cpp ==============

struct A {
        void foo(int) __unaligned {;}
};

void func(void (A::*a)(int) __unaligned); 


void goo() {
  func(&A::foo);
}

=======================================


>>> clang -v
clang version 7.0.0 (trunk 326962)
...

>>> clang++ -c fine.cpp -fms-extensions
clang-7.0: .../llvm/tools/clang/include/clang/AST/Type.h:304: void
clang::Qualifiers::addCVRQualifiers(unsigned int): Assertion `!(mask &
~CVRMask) && "bitmask contains non-CVR bits"' failed.
#0 0x00000000042f97c1 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
.../llvm/lib/Support/Unix/Signals.inc:398:0
#1 0x00000000042f9852 PrintStackTraceSignalHandler(void*)
.../llvm/lib/Support/Unix/Signals.inc:462:0
#2 0x00000000042f7d38 llvm::sys::RunSignalHandlers()
.../llvm/lib/Support/Signals.cpp:49:0
#3 0x00000000042f9159 SignalHandler(int)
.../llvm/lib/Support/Unix/Signals.inc:252:0
#4 0x00007fdcc23145e0 __restore_rt (/lib64/libpthread.so.0+0xf5e0)
#5 0x00007fdcc0f061f7 __GI_raise (/lib64/libc.so.6+0x351f7)
#6 0x00007fdcc0f078e8 __GI_abort (/lib64/libc.so.6+0x368e8)
#7 0x00007fdcc0eff266 __assert_fail_base (/lib64/libc.so.6+0x2e266)
#8 0x00007fdcc0eff312 (/lib64/libc.so.6+0x2e312)
#9 0x00000000045d2992 clang::Qualifiers::addCVRQualifiers(unsigned int)
.../llvm/tools/clang/include/clang/AST/Type.h:305:0
#10 0x0000000006832265 clang::Qualifiers::fromCVRMask(unsigned int)
.../llvm/tools/clang/include/clang/AST/Type.h:248:0
#11 0x000000000750296a (anonymous
namespace)::CXXNameMangler::mangleType(clang::FunctionProtoType const*)
.../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2691:0
#12 0x0000000007503321 (anonymous
namespace)::CXXNameMangler::mangleType(clang::MemberPointerType const*)
.../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2870:0
#13 0x00000000075013a2 (anonymous
namespace)::CXXNameMangler::mangleType(clang::QualType)
.../llvm/tools/clang/include/clang/AST/TypeNodes.def:69:0
#14 0x0000000007502f0f (anonymous
namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType
const*, bool, clang::FunctionDecl const*)
.../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:2785:0
#15 0x00000000074fc841 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncodingBareType(clang::FunctionDecl
const*) .../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:760:0
#16 0x00000000074fc28c (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*)
.../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:668:0
#17 0x00000000074fc101 (anonymous
namespace)::CXXNameMangler::mangle(clang::NamedDecl const*)
.../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:646:0
#18 0x0000000007509cd0 (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::NamedDecl const*,
llvm::raw_ostream&) .../llvm/tools/clang/lib/AST/ItaniumMangle.cpp:4739:0
#19 0x00000000075109c1 clang::MangleContext::mangleName(clang::NamedDecl
const*, llvm::raw_ostream&) .../llvm/tools/clang/lib/AST/Mangle.cpp:153:0
#20 0x00000000046b0532 getMangledNameImpl(clang::CodeGen::CodeGenModule const&,
clang::GlobalDecl, clang::NamedDecl const*, bool)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:908:0
#21 0x00000000046b0cc0
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:989:0
#22 0x00000000046b8451
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2554:0
#23 0x0000000004976bb0 EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&,
clang::FunctionDecl const*) .../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:2290:0
#24 0x0000000004983cd8 EmitDirectCallee(clang::CodeGen::CodeGenFunction&,
clang::FunctionDecl const*) .../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:4240:0
#25 0x0000000004983e16 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) .../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:4257:0
#26 0x0000000004983dbb clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) .../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:4251:0
#27 0x0000000004983b30
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
.../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:4216:0
#28 0x00000000049b6142 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:517:0
#29 0x00000000049c953f
_ZN5clang15StmtVisitorBaseINS_8make_ptrEN12_GLOBAL__N_117ScalarExprEmitterEPN4llvm5ValueEIEE5VisitEPNS_4StmtE
.../debug_build/tools/clang/include/clang/AST/StmtNodes.inc:329:0
#30 0x00000000049b5382 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:358:0
#31 0x00000000049c774e
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
.../llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp:3834:0
#32 0x000000000496b446 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
.../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:178:0
#33 0x000000000496b3d3
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
.../llvm/tools/clang/lib/CodeGen/CGExpr.cpp:163:0
#34 0x0000000004620d79 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
.../llvm/tools/clang/lib/CodeGen/CGStmt.cpp:118:0
#35 0x0000000004621b1c
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
.../llvm/tools/clang/lib/CodeGen/CGStmt.cpp:388:0
#36 0x000000000469a7ef
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) .../llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1161:0
#37 0x000000000469b35e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
.../llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:1326:0
#38 0x00000000046bc28b
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) .../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:3590:0
#39 0x00000000046b7092
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) .../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2286:0
#40 0x00000000046b6212
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2063:0
#41 0x00000000046bfde0
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
.../llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:4327:0
#42 0x000000000515eebe (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
.../llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:159:0
#43 0x0000000005158af7
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
.../llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:170:0
#44 0x00000000063d8f50 clang::ParseAST(clang::Sema&, bool, bool)
.../llvm/tools/clang/lib/Parse/ParseAST.cpp:156:0
#45 0x0000000004c4d46e clang::ASTFrontendAction::ExecuteAction()
.../llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1007:0
#46 0x0000000005157674 clang::CodeGenAction::ExecuteAction()
.../llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1044:0
#47 0x0000000004c4ceaf clang::FrontendAction::Execute()
.../llvm/tools/clang/lib/Frontend/FrontendAction.cpp:908:0
#48 0x0000000004be2cfc
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
.../llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:992:0
#49 0x0000000004d8cbae
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
.../llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:255:0
#50 0x00000000021ac238 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) .../llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#51 0x00000000021a1c34 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) .../llvm/tools/clang/tools/driver/driver.cpp:309:0
#52 0x00000000021a28cb main .../llvm/tools/clang/tools/driver/driver.cpp:389:0
#53 0x00007fdcc0ef2c05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#54 0x000000000219f4b9 _start (.../debug_build/bin/clang-7.0+0x219f4b9)
Stack dump:
0.      Program arguments: .../debug_build/bin/clang-7.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
fine.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fno-escaping-block-tail-calls -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -coverage-notes-file test_dir/fine.gcno -resource-dir
.../debug_build/lib/clang/7.0.0 -c-isystem
.../last_debug/projects/openmp/runtime/src -c-isystem . -cxx-isystem
.../last_debug/projects/openmp/runtime/src -cxx-isystem . -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward
-internal-isystem /usr/local/include -internal-isystem
.../debug_build/lib/clang/7.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir test_dir -ferror-limit 19 -fmessage-length 0
-fms-extensions -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -o fine.o -x c++ fine.cpp 
1.      <eof> parser at end of file
2.      fine.cpp:8:6: LLVM IR generation of declaration 'goo'
3.      fine.cpp:8:6: Generating code for declaration 'goo'
4.      fine.cpp:5:6: Mangling declaration 'func'
clang-7.0: error: unable to execute command: Aborted (core dumped)
clang-7.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 326962)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: .../last_debug/bin
clang-7.0: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-7.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7.0: note: diagnostic msg: /tmp/fine-2739e8.cpp
clang-7.0: note: diagnostic msg: /tmp/fine-2739e8.sh
clang-7.0: note: diagnostic msg: 

********************

-- 
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/20180308/47130bc3/attachment.html>


More information about the llvm-bugs mailing list