https://bugs.llvm.org/show_bug.cgi?id=44150
Bug ID: 44150
Summary: [10.master regression] false positive warning
-Wreturn-stack-address
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: kyrylo.bohdane...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
I have noticed this with clang master (llvm 10) (built from
3b901ce36755bf67c62d9ba5866ad9e0ab9f546d). The following snippet produces false
positive warning:
#include <vector>
std::vector<int>::const_iterator test(const std::vector<int>& data) {
std::vector iters{data.begin()};
return iters.front();
}
Compiler output:
prog.cc:5:10: warning: address of stack memory associated with local variable
'iters' returned [-Wreturn-stack-address]
return iters.front();
^~~~~
1 warning generated.
This is clearly incorrect, because function is supposed to return a (copy of)
iterator to the argument vector ref.
Earlier release versions of clang do not produce such warning.
P.S. This bug does not duplicate #21218, since the latter was reported much
earlier and this only affects current master.
--
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