[Lldb-commits] [lldb] r323119 - Fix uninitialized variable in GoParser
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 22 06:32:43 PST 2018
Author: teemperor
Date: Mon Jan 22 06:32:43 2018
New Revision: 323119
URL: http://llvm.org/viewvc/llvm-project?rev=323119&view=rev
Log:
Fix uninitialized variable in GoParser
Summary:
`m_last_tok` isn't initialized anywhere before it's used the first time (most likely in the `GoParser::Rule::error` method), which causes most of the GoParser tests to fail with sanitizers enabled with errors like this:
```
GoParser.cpp:52:21: runtime error: load of value <random value>, which is not a valid value for type 'GoLexer::TokenType'
UndefinedBehaviorSanitizer: undefined-behavior GoParser.cpp:52:21
```
Reviewers: ribrdb, davide, labath
Reviewed By: labath
Subscribers: labath, lldb-commits
Differential Revision: https://reviews.llvm.org/D42339
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp?rev=323119&r1=323118&r2=323119&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoParser.cpp Mon Jan 22 06:32:43 2018
@@ -67,7 +67,9 @@ private:
size_t m_pos;
};
-GoParser::GoParser(const char *src) : m_lexer(src), m_pos(0), m_failed(false) {}
+GoParser::GoParser(const char *src)
+ : m_lexer(src), m_pos(0), m_last_tok(GoLexer::TOK_INVALID),
+ m_failed(false) {}
GoASTStmt *GoParser::Statement() {
Rule r("Statement", this);
More information about the lldb-commits
mailing list