https://bugs.llvm.org/show_bug.cgi?id=40641
Bug ID: 40641
Summary: Clang generates wrong optimized code for std::rotate
followed by std::min_element with libc++
Product: clang
Version: 7.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: steffen.mueth...@iwr.uni-heidelberg.de
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
Created attachment 21442
--> https://bugs.llvm.org/attachment.cgi?id=21442&action=edit
Failing code, check return code to see if it worked
When compiling with clang 7 "-std=libc++ -O3", the attached program generates
wrong output on x86_64 (both Linux and macOS). In particular, the rotated
sequence contains one of the items twice, and one item has disappeared.
I did some testing with the following outcomes:
- The code only fails in optimized mode
- The code only fails when using libc++, when compiling with the GCC 8
libstdc++, the generated code is correct
- On the other hand, when compiling the code with GCC 8 and libc++, the
generated code is also correct
- The code only fails when the output of std::min_element is used as the middle
parameter of std:rotate
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs