From f7d4f0b1b9519fa10eb04cb195bdf7b5044d73c7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 20 Mar 2020 08:10:59 -0600 Subject: [PATCH] Fix assert in c-exp.y 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 * c-exp.y (lex_one_token): Fix assert. --- gdb/ChangeLog | 4 ++++ gdb/c-exp.y | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 583ec9c81e3..1be14b15d18 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-03-20 Tom Tromey + + * c-exp.y (lex_one_token): Fix assert. + 2020-03-20 Tom Tromey * ada-tasks.c (read_atcb): Use smaller length in strncpy call. 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; -- 2.30.2