[pushed,2/2] Fix assert in c-exp.y

Message ID 20200320143622.27497-3-tromey@adacore.com
State New
Headers show
Series
  • Minor -fsanitize=address fixes
Related show

Commit Message

Tom Tromey March 20, 2020, 2:36 p.m.
The "restrict" patch added some asserts to c-exp.y, but one spot was
copy-pasted and referred to the wrong table.  This was pointed out by
-fsanitize=address.  This patch fixes the bug.

gdb/ChangeLog
2020-03-20  Tom Tromey  <tromey@adacore.com>

	* c-exp.y (lex_one_token): Fix assert.
---
 gdb/ChangeLog | 4 ++++
 gdb/c-exp.y   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.21.1

Patch

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 50a2eef98b5..a4efaab79c8 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -2580,7 +2580,7 @@  lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
 	if ((tokentab2[i].flags & FLAG_CXX) != 0
 	    && par_state->language ()->la_language != language_cplus)
 	  break;
-	gdb_assert ((tokentab3[i].flags & FLAG_C) == 0);
+	gdb_assert ((tokentab2[i].flags & FLAG_C) == 0);
 
 	pstate->lexptr += 2;
 	yylval.opcode = tokentab2[i].opcode;