This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix c++/23307, ICE on invalid
On Wed, 10 Aug 2005, Nathan Sidwell wrote:
> Richard Guenther wrote:
> > This fixes the ICE by changing an gcc_assert into returning
> > error_mark_node. I seriously question the use of asserts
> > in paths where we might deal with erroneous input.
>
> The assert indicates that the program logic expected nothing odd there, even
> for incorrect source. Have you satisfied yourself that the caller of
> cp_parser_temnplate_id has not screwed up.
I understand that - but it is usually very hard to convince yourself that
in any case you'll end up with correct state if you're in a path dealing
with errors. Using assert in such places is asking for trouble ...
> I'm nervous of turning asserts into error checks, without understanding the
> context :)
... and returning error_mark_node instead cannot make things worse from
a user perspective. It might at worst move the ICE to some other place.
And of course I didn't dig further than going up the callstack one or
two functions and seeing error_mark_node handled. Somebody familiar
with the C++ frontend / parser can verify where the logic went wrong,
though I doubt you can get the logic right for any sort of weird input ;)
Richard.