[llvm-bugs] [Bug 43710] New: clang++ miscompiles against MSVC standard library with -O2
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 18 05:57:31 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43710
Bug ID: 43710
Summary: clang++ miscompiles against MSVC standard library with
-O2
Product: new-bugs
Version: 9.0
Hardware: PC
OS: other
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: karen at codesynthesis.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 22688
--> https://bugs.llvm.org/attachment.cgi?id=22688&action=edit
Test program
Hello,
My system is Windows 10 with clang 9.0.0 (installed with
https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe) and Microsoft Visual
Studio Community 2019, Version 16.3.1.
Under some circumstances a non-empty string passed into a function is seen by
the function code as an empty string.
The attached program reproduces the issue. It is expected to print 'abc' but
prints '' if compiled with -O2 or -O3:
> clang++ -std=c++2a test.cxx
> a.exe
'abc'
>clang++ -std=c++2a -O2 test.cxx
>a.exe
''
Note that the issue also reproduces if compile with clang-cl:
> clang-cl /std:c++17 /EHsc test.cxx
> test.exe
'abc'
> clang-cl /std:c++17 /EHsc /O2 test.cxx
> test.exe
''
Also note that the attached program is not exactly trivial but I was unable to
reduce it further.
--
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/20191018/8a73c02f/attachment.html>
More information about the llvm-bugs
mailing list