From: Jakub Jelinek Date: Wed, 4 Jan 2017 20:05:14 +0000 (+0100) Subject: re PR c++/71182 (parser.c cp_lexer_previous_token sanitizer detects member call on... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=066435fe10c4982780b05844793ddf287ac1d225;p=gcc.git re PR c++/71182 (parser.c cp_lexer_previous_token sanitizer detects member call on null pointer) PR c++/71182 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the assertion, as lexer->buffer may be NULL. * g++.dg/cpp0x/pr71182.C: New test. From-SVN: r244070 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 48061a02f8b..16294204b6d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-01-04 Jakub Jelinek + + PR c++/71182 + * parser.c (cp_lexer_previous_token): Use vec_safe_address in the + assertion, as lexer->buffer may be NULL. + 2017-01-04 Marek Polacek PR c++/77545 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b94270d39f8..b4b8f13df2c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -766,7 +766,7 @@ cp_lexer_previous_token (cp_lexer *lexer) /* Skip past purged tokens. */ while (tp->purged_p) { - gcc_assert (tp != lexer->buffer->address ()); + gcc_assert (tp != vec_safe_address (lexer->buffer)); tp--; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a3da3ba85d..53ba248dab9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-04 Jakub Jelinek + + PR c++/71182 + * g++.dg/cpp0x/pr71182.C: New test. + 2017-01-04 Kelvin Nilsen PR target/78056 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71182.C b/gcc/testsuite/g++.dg/cpp0x/pr71182.C new file mode 100644 index 00000000000..c5c0c543bca --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71182.C @@ -0,0 +1,12 @@ +// PR c++/71182 +// { dg-do compile { target c++11 } } + +class A { + template void As(); +}; +template class B : A { + void f() { + A *g ; + g ? g->As() : nullptr; + } +};