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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to