RFD: improved diagnostics when reading module files

Harald Anlauf anlauf@gmx.de
Fri Apr 6 19:35:00 GMT 2018


Dear all,

while chasing down an ICE that occurred when reading inconsistent
modules files, I found that it might be helpful to change an assert
in module.c:5164 into some error message.  Suggestion:

Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c        (revision 259152)
+++ gcc/fortran/module.c        (working copy)
@@ -5161,7 +5161,13 @@
              if (p->u.pointer == NULL)
                associate_integer_pointer (p, c);
              mio_pool_string (&comp_name);
-             gcc_assert (comp_name == c->name);
+             if (comp_name != c->name)
+               {
+                 gfc_error_now ("While reading module files: mismatch in "
+                                "derived type components: %qs != %qs",
+                                comp_name, c->name);
+               }
+             /* gcc_assert (comp_name == c->name); */
              skip_list (1); /* component end.  */
            }
          mio_rparen (); /* component list closing.  */


Is this something worth considering?

Harald



More information about the Fortran mailing list