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

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #6)
> Related to pr69544. Note that compiling the test with 5.3.0 or trunk (6.0)
> gives now an ICE, r218570 gives the error and r218658 gives the ICE.

Hi, if you want to fix the ICEs for release builds even if you don't get a good
location, then do:

--- error.c     (revision 232580)
+++ error.c     (working copy)
@@ -934,7 +934,15 @@
          loc = &gfc_current_locus;
        else
          loc = va_arg (*text->args_ptr, locus *);
-       gcc_assert (loc->nextc - loc->lb->line >= 0);
+       gcc_assert_checking (loc->nextc - loc->lb->line >= 0);
+       /* FIXME: This should not happen, but it does: See PR44491 */
+       if (loc == NULL || loc->lb == NULL
+           || loc->nextc - loc->lb->line < 0)
+         {
+           text->set_location (0, UNKNOWN_LOCATION, true);
+           pp_string (pp, result[0]);
+           return true;
+         }
        unsigned int offset = loc->nextc - loc->lb->line;
        /* If location[0] != UNKNOWN_LOCATION means that we already
           processed one of %C/%L.  */

Reply via email to