This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Fix PR 18023


We have some code in place to support assigned formats. I don't think this
actually works, but I haven't verified, as I didn't want to look up the
semantics of it, but the error in PR 18023 seems to say quite clearly that it
wouldn't work. Parts of this code canceled checking of the arguments passed to
a PRINT statement, so that the frontend would e.g. accept a statement of the
form "PRINT x", where x is a character variable.

This patch fixes this, testing in progress. I will also add a testcase to the
testsuite. Ok?

- Tobi

2004-10-16  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/18023
	* io.c (resolve_tag): Tighten up exception for assigned formats.

Index: io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/io.c,v
retrieving revision 1.15
diff -u -p -r1.15 io.c
--- io.c        16 Sep 2004 16:00:42 -0000      1.15
+++ io.c        16 Oct 2004 16:18:15 -0000
@@ -968,10 +968,10 @@ resolve_tag (const io_tag * tag, gfc_exp
   if (e->ts.type != tag->type)
     {
       /* Format label can be integer varibale.  */
-      if (tag != &tag_format)
+      if (tag != &tag_format || e->ts.type != BT_INTEGER)
         {
           gfc_error ("%s tag at %L must be of type %s", tag->name, &e->where,
-          gfc_basic_typename (tag->type));
+                    gfc_basic_typename (tag->type));
           return FAILURE;
         }
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]