https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72823

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Sorry about this.

(In reply to Jakub Jelinek from comment #2)
> Created attachment 39062 [details]
> gcc7-pr72823.patch
> 
> Untested fix.

Thanks.  ppalka on IRC said that this fixed it for him.

> IMHO either you want to make sure the documented invariant is
> honored, or you should remove the documentation for the invariant and kill
> the assert.

I believe you're referring to the this comment within _cpp_valid_ucn:

   If CHAR_RANGE and LOC_READER are non-NULL, then position information is
   read from *LOC_READER and CHAR_RANGE->m_finish is updated accordingly.  */

and this assert:

  /* char_range and loc_reader must either be both NULL, or both be
     non-NULL.  */
  gcc_assert ((char_range != NULL) == (loc_reader != NULL));

within that function.

This definitely looks to be an overzealous assert, but for some reason it's not
firing for me on gcc112.

I think the condition for _cpp_valid_ucn should be:

  /* if loc_reader is non-NULL, then so must char_range.  */

and the assert can be moved to within the if (loc_reader) clause.  Not sure why
I'm not seeing it fail; am investigating further.

Reply via email to