<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 - clang-cl -m32 crashes in MultiByteToWideChar on Windows"
href="https://bugs.llvm.org/show_bug.cgi?id=38022">38022</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-cl -m32 crashes in MultiByteToWideChar on Windows
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dmajor@mozilla.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, zturner@google.com
</td>
</tr></table>
<p>
<div>
<pre>clang version 7.0.0 (trunk 336115)
It's a 64-bit clang-cl trying to build 32-bit code with -m32. The crash doesn't
happen if I remove the -m32.
$ cat conftest.c
main(){return(0);}
$ clang-cl.exe -m32 -o conftest conftest.c
0:000> kc
# Call Site
00 ntdll!CountUTF8ToUnicode
01 KERNELBASE!MultiByteToWideChar
02 clang_cl!llvm::sys::windows::CodePageToUTF16
03 clang_cl!llvm::sys::windows::UTF8ToUTF16
04 clang_cl!Execute
05 clang_cl!llvm::sys::ExecuteAndWait
06 clang_cl!clang::driver::Command::Execute
07 clang_cl!clang::driver::Compilation::ExecuteCommand
08 clang_cl!clang::driver::Compilation::ExecuteJobs
09 clang_cl!clang::driver::Driver::ExecuteCompilation
0a clang_cl!main
0b clang_cl!invoke_main
0c clang_cl!__scrt_common_main_seh
0d KERNEL32!BaseThreadInitThunk
0e ntdll!RtlUserThreadStart
At frame 02, in CodePageToUTF16, `original` has garbage contents -- in fact
these fields look like wide-character text:
0:000> ?? original
class llvm::StringRef * 0x00000045`f138d090
=00007ff7`1d6dace8 npos : 0xffffffff`ffffffff
+0x000 Data : 0x00610044`00700070 "--- memory read error at
address 0x00610044`00700070 ---"
+0x008 Length : 0x0052005c`00610074
0:000> du 45`f138d090
00000045`f138d090 "ppData\R"</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>