This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: partially PR c++/17401


Steven Bosscher wrote:

Hi,

As Giovanni points out in the audit trail, this only fixes the part
of the bug where "__null" has to be printed, not other cases where
ridpointers[id] does not point to an identifier node.

It is quite beyond me why anyone would put non-identifier tree nodes
in the ridpointer array - fortunately this is only done for a small
number of keywords.  Like "__null" without this patch.
This leads to an ICE in c_parse_error when it thinks it can print a
CCP_NAME but the token value turns out to be a tree for an integer
constant.  The ICE comes from tree checking.    The test case for
the ICE is this:

class foo { virtual void bar () = __null; };

Fortunately we never actually read ridpointers[RID_NULL] except for
error reporting, so it is safe to just leave the identifier node
"__null" (which is created in "init_reswords" (which should really
be static to lex.c, btw).

This patch only squelches the ICE.  The diagnostic g++ now gives is
still not very helpful:
t.cc:1: error: expected `0' before "__null"
t.cc:1: error: invalid initializer for virtual method `virtual void foo::bar()'
t.cc:1: error: expected `;' before "__null"

But this is not as bad as the ICE...

Bootstrapped and tested on x86_64-suse-linux-gnu, OK?


Yes.

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]