[llvm-bugs] [Bug 46384] New: Fatal error in handling dllimport

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 18 10:02:29 PDT 2020


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

            Bug ID: 46384
           Summary: Fatal error in handling dllimport
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sunil_srivastava at playstation.sony.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

Created attachment 23629
  --> https://bugs.llvm.org/attachment.cgi?id=23629&action=edit
sh script in dump

Following simple example gives a fatal error with x86_64-pc-win32 triple. It
started happening with r326397.

$ cat e.c
extern __declspec(dllimport) __attribute__((weak)) int num;
int f(int *en) { return &num == en; }

$ C/bin/clang --target=x86_64-pc-win32 -c e.c
Global is marked as dllimport, but not external
i32* @num
fatal error: error in backend: Broken module found, compilation aborted!
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: C/bin/clang --target=x86_64-pc-win32 -c e.c 
1.      <eof> parser at end of file
2.      Per-function optimization
 #0 0x000055b9ecb45e7a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(C/bin/clang+0x31bfe7a)
 #1 0x000055b9ecb43b44 llvm::sys::RunSignalHandlers() (C/bin/clang+0x31bdb44)
 #2 0x000055b9ecb43db5 llvm::sys::CleanupOnSignal(unsigned long)
(C/bin/clang+0x31bddb5)
 #3 0x000055b9ecab312f llvm::CrashRecoveryContext::HandleExit(int)
(C/bin/clang+0x312d12f)
 #4 0x000055b9ecb3c927 llvm::sys::Process::Exit(int) (C/bin/clang+0x31b6927)
 #5 0x000055b9eab12c79 LLVMErrorHandler(void*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, bool)
(C/bin/clang+0x118cc79)
 #6 0x000055b9ecabaa79 llvm::report_fatal_error(llvm::Twine const&, bool)
(C/bin/clang+0x3134a79)
 #7 0x000055b9ecababb8 (C/bin/clang+0x3134bb8)
 #8 0x000055b9ec4d1a95 (C/bin/clang+0x2b4ba95)
 #9 0x000055b9ec452e3a
llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&)
(C/bin/clang+0x2acce3a)
#10 0x000055b9ecdc0a89 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) (C/bin/clang+0x343aa89)
#11 0x000055b9ecdc274d clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) (C/bin/clang+0x343c74d)
#12 0x000055b9ed93b985
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(C/bin/clang+0x3fb5985)
#13 0x000055b9ee20a999 clang::ParseAST(clang::Sema&, bool, bool)
(C/bin/clang+0x4884999)
#14 0x000055b9ed93bb38 clang::CodeGenAction::ExecuteAction()
(C/bin/clang+0x3fb5b38)
#15 0x000055b9ed32d749 clang::FrontendAction::Execute() (C/bin/clang+0x39a7749)
#16 0x000055b9ed2e99c2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(C/bin/clang+0x39639c2)
#17 0x000055b9ed3dc871
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(C/bin/clang+0x3a56871)
#18 0x000055b9eab14624 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (C/bin/clang+0x118e624)
#19 0x000055b9eab108b9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(C/bin/clang+0x118a8b9)
#20 0x000055b9ed1c6855 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long)
(C/bin/clang+0x3840855)
#21 0x000055b9ecab2f73
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(C/bin/clang+0x312cf73)
#22 0x000055b9ed1c7328
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.149) (C/bin/clang+0x3841328)
#23 0x000055b9ed1a2865
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const (C/bin/clang+0x381c865)
#24 0x000055b9ed1a330f
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(C/bin/clang+0x381d30f)
#25 0x000055b9ed1abb39
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(C/bin/clang+0x3825b39)
#26 0x000055b9eaa619c2 main (C/bin/clang+0x10db9c2)
#27 0x00007f817004ab97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#28 0x000055b9eab1041a _start (C/bin/clang+0x118a41a)
clang-11: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
4cd7ba7eca194feccc80413d3b8021ebd03a4f2d)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: /home/sunil/CLG/T/C/bin
clang-11: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/e-ad0fa1.c
clang-11: note: diagnostic msg: /tmp/e-ad0fa1.sh
clang-11: note: diagnostic msg: 

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


The log of r326397 is:

commit cba8d1219802779f8c3df60631c293020e865495
Author: Rafael Espindola <rafael.espindola at gmail.com>
Date:   Thu Mar 1 00:35:47 2018 +0000

    Start setting dllimport/dllexport in setGVProperties.

    This is the next step in setting dso_local for COFF.

    The patches changes setGVProperties to first set dllimport/dllexport
    and changes a few cases that were setting dllimport/dllexport
    manually. With this a few more GVs are marked dso_local.

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326397
91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp                      |  3 +-
lib/CodeGen/CGCXXABI.h                     |  1 +
lib/CodeGen/CGDecl.cpp                     |  7 ---
lib/CodeGen/CGObjCGNU.cpp                  | 40 +++----------
lib/CodeGen/CGObjCMac.cpp                  | 21 ++-----
lib/CodeGen/CGVTables.cpp                  |  7 ++-
lib/CodeGen/CodeGenModule.cpp              | 96 ++++++++++++++----------------
lib/CodeGen/CodeGenModule.h                | 18 +++---
lib/CodeGen/ItaniumCXXABI.cpp              | 21 ++-----
lib/CodeGen/MicrosoftCXXABI.cpp            |  7 +--
test/CodeGenCXX/dllexport-ctor-closure.cpp | 18 +++---
test/CodeGenCXX/dllexport.cpp              |  6 +-
test/CodeGenObjC/dllstorage.m              | 32 +++++-----
test/PCH/dllexport-default-arg-closure.cpp |  2 +-
14 files changed, 110 insertions(+), 169 deletions(-)

-- 
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/20200618/8d532945/attachment-0001.html>


More information about the llvm-bugs mailing list