public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed] PR fortran/85407 -- convert assert to fatal error
@ 2018-12-27  0:57 Steve Kargl
  0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2018-12-27  0:57 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

Back in April, I told Harald I would get around to committing
the attached patch.  Well, "around" has arrived.  The patch
has been tested on i586-*-freebsd and x86_64-*-freebsd.

The patch converts an assert into a gfc_fatal_error(), which
gives a user some information about the failure.  There is
no testcase as one need to go out of one's way to corrupt
the components in a derived typed in a *.mod file.

2018-12-26  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/85407
	* module.c (read_module): Convert assert to fatal error to give 
	user a sensible error message.

-- 
Steve

[-- Attachment #2: pr85407.diff --]
[-- Type: text/x-diff, Size: 706 bytes --]

Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c	(revision 267418)
+++ gcc/fortran/module.c	(working copy)
@@ -5180,7 +5180,13 @@ read_module (void)
 	      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_fatal_error ("Mismatch in components of derived type "
+				   "%qs from %qs at %C: expecting %qs, "
+				   "but got %qs", sym->name, sym->module,
+				   c->name, comp_name);
+		}
 	      skip_list (1); /* component end.  */
 	    }
 	  mio_rparen (); /* component list closing.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-26 20:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27  0:57 [Committed] PR fortran/85407 -- convert assert to fatal error Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).