[patch, libfortran] PR38439 F0.d formatting, reading vs writing

Jerry DeLisle jvdelisle@verizon.net
Mon Oct 12 00:49:00 GMT 2009


Hi all,

While preparing some test cases for this PR, I noticed comment #5 where Tobias 
had a question about '(1pd0.3)'.

This was not properly being rejected because of a bug in the logic for 
'(1pf0.3)'.  The f0.3 is allowed for writing and the processor determines the 
width.  It is not allowed for reading.

I have incorporated these into the attached two new test cases that I will 
commit shortly. Notice the allowance for legacy code in the fmt_error_10.f test 
case where we give a warning at compile time.

The following patch I will also commit as obvious. Regression tested on X86-64.

Regards,

Jerry

2009-10-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/38439
	* io/format.c (parse_format_list): Correct logic for FMT_F reading vs
	writing. Code clean-up.

Index: io/format.c
===================================================================
--- io/format.c	(revision 152651)
+++ io/format.c	(working copy)
@@ -933,7 +933,7 @@ parse_format_list (st_parameter_dt *dtp, bool *sav
  	  tail->u.real.d = fmt->value;
  	  break;
  	}
-      if (t == FMT_F || dtp->u.p.mode == WRITING)
+      if (t == FMT_F && dtp->u.p.mode == WRITING)
  	{
  	  if (u != FMT_POSINT && u != FMT_ZERO)
  	    {
@@ -941,13 +941,10 @@ parse_format_list (st_parameter_dt *dtp, bool *sav
  	      goto finished;
  	    }
  	}
-      else
+      else if (u != FMT_POSINT)
  	{
-	  if (u != FMT_POSINT)
-	    {
-	      fmt->error = posint_required;
-	      goto finished;
-	    }
+	  fmt->error = posint_required;
+	  goto finished;
  	}

        tail->u.real.w = fmt->value;

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fmt_error_9.f
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091012/63db2b9b/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fmt_error_10.f
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091012/63db2b9b/attachment-0001.ksh>


More information about the Fortran mailing list