#include <llvm/ADT/SmallVectorExtras.h> int main() { int data[] = {1,2,3,4,5}; bool changed = false; auto fn = [&](int val) { changed = true; return val; }; auto out = llvm::map_to_vector(data, fn); return changed; } Program should print 1. However, on GCC 12.* and 13.* for -O1 & -O2, the output is 0. // Summary of Results // -O0 -O1/2 -O3 // 11.* pass pass pass // 12.* pass FAIL pass // 13.* pass FAIL pass // 14.* pass pass pass
https://www.godbolt.org/z/T5qE5M87T shows the issue on Compiler Explorer
This has already been fixed and it is a dup of bug 115033 *** This bug has been marked as a duplicate of bug 115033 ***
>// 14.* pass pass pass No this is incorrect. 14.1.0 fails at -O2, 14.2.0 passes.
Yes, it fails on 14.1. I was too quick to conclude it was fixed on 14.*.