https:llvm.org/bugs/show_bug.cgi?id=22861
Bug ID: 22861
Summary: "return { value }" returns uninitialized
std::initializer_list
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Testcase:
#include <initializer_list>
#include <cstdio>
std::initializer_list<int> MakeList() {
return { 7 };
}
void helper(std::initializer_list<int> list) {
for (auto i : list) {
printf("%d\n", i);
}
}
int main() {
helper(MakeList());
}
This prints "32767" on my system, and has an msan error indicating that the
list allocated in MakeList was uninitialized memory, later read in the use of
'i' at the printf callsite.
GCC prints "7" which is what I'd expect. It's an x-value shouldn't go away
until the ';' at the end of helper(), right?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs