[llvm-bugs] [Bug 31592] New: Analyzer crash initializing field with string literal
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jan 9 16:20:24 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31592
Bug ID: 31592
Summary: Analyzer crash initializing field with string literal
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: dcoughlin at apple.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
As reported by Miklos Vajna on cfe-dev, the following code causes an assertion
failure in the static analyzer:
$ cat field_initializer.cpp
struct S;
template <typename T> struct C {
public:
C(const S &left_, const T &right_) : left(left_), right(right_) {}
private:
const S &left;
const T &right;
};
template <typename T, int N>
inline T operator+(const T &left, const char (&right)[N]) {
return C<const char[N]>(left, right);
}
struct S {
template <typename T> S(T &) {}
template <typename T> S(const C<T> &) {}
};
S f() { return S("{") + "}"; }
$ clang -cc1 -analyze -analyzer-checker=core field_initializer.cpp
'Assume' not implemented for this NonLoc
UNREACHABLE executed at
/Volumes/Data/Clangs/OpenSourceGit/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp:126!
0 clang 0x0000000105995d46 llvm::sys::RunSignalHandlers() +
86
1 clang 0x0000000105997429 SignalHandler(int) + 361
2 libsystem_platform.dylib 0x00007fff8b56ebba _sigtramp + 26
Stack dump:
0. Program arguments: ../build/clang-ninja/bin/clang -cc1 -analyze
-analyzer-checker=core field_initializer.cpp
1. <eof> parser at end of file
2. While analyzing stack:
#0 C(const S &left_, char const &right_[2]) : left(left_), right(right_) {}
#1 template<> inline S operator+<S, 2>(const S &left, const char
(&right)[2])
#2 S f()
3. field_initializer.cpp:5:52: Error evaluating initializer
Abort trap: 6
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170110/7974f869/attachment.html>
More information about the llvm-bugs
mailing list