[llvm-bugs] [Bug 38022] New: clang-cl -m32 crashes in MultiByteToWideChar on Windows

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 2 10:29:01 PDT 2018


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

            Bug ID: 38022
           Summary: clang-cl -m32 crashes in MultiByteToWideChar on
                    Windows
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dmajor at mozilla.com
                CC: llvm-bugs at lists.llvm.org, zturner at google.com

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"

-- 
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/20180702/0fca911e/attachment.html>


More information about the llvm-bugs mailing list