<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Fatal error in handling dllimport"
href="https://bugs.llvm.org/show_bug.cgi?id=46384">46384</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Fatal error in handling dllimport
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sunil_srivastava@playstation.sony.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23629" name="attach_23629" title="sh script in dump">attachment 23629</a> <a href="attachment.cgi?id=23629&action=edit" title="sh script in dump">[details]</a></span>
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 <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> 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>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
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>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
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 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
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 <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>>
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: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@326397">https://llvm.org/svn/llvm-project/cfe/trunk@326397</a>
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(-)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>