<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 - Miscompilation when using map in C++ and targeting MinGW-w64"
href="https://bugs.llvm.org/show_bug.cgi?id=43375">43375</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Miscompilation when using map in C++ and targeting MinGW-w64
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>RogerKung.WIN@outlook.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22537" name="attach_22537" title="Test code">attachment 22537</a> <a href="attachment.cgi?id=22537&action=edit" title="Test code">[details]</a></span>
Test code
When using map (from STL) in C++ and targeting MinGW-w64, Clang may cause
miscompilation. I run into a MinGW-w64 runtime failure when attempting to run
the generated executable program. The error message is:
Mingw-w64 runtime failure:
Unknown pseudo relocation protocol version 16777216.
Moreover, when compiling with GCC, everything works fine.
The compile command I use is as follows:
clang++ 'demo.cpp' -o 'demo.exe' -Wall -g -O2 -static-libgcc
--target=x86_64-w64-mingw -std=c++17
g++ 'demo.cpp' -o 'demo.exe' -Wall -g -O2 -static-libgcc -std=c++17
I use Clang 8.0.1 64-bit and MinGW-w64 (GCC) 8.1.0 on Windows.</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>