This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [patch, libgfortran] Fix PR27304 Data descriptors exhausted


Jerry DeLisle wrote:
Brooks Moses wrote:

Brooks Moses wrote:

Thus, I'm a bit baffled: is it possible for this error to occur except in the case (from your test program) where there are no data descriptors in the format at all? If not, perhaps an error message of "No data descriptors found in format" would be better.



And, of course, just as I hit send, I thought of a better wording (I think): "Format for nonempty I/O list contains no data descriptors"


- Brooks


The error occurs if there has been a reversion and no descriptors available. There is a data descriptor available in the following example so the above message just doesn't quite fit.

      program test
      implicit none
      integer :: n
      n = 1
      write(*,"(i7,(' abcd'))") n, n
      end program test


So I would like to propose the error say:


At line 5 of file fmt_exhaust.f90
Fortran runtime error: Missing data descriptor in format after reversion

I will amend the patch accordingly unless anyone has grief with this. I just wanted to come up with something brief and to the point.

Is this OK to commit?

Regarding a test case. See my thread on "Testing for run-time errors"

Attached is a revised patch and a testcase that just verifies that we do throw a runtime error.


Hope this is final. OK for trunk and 4.1 a bit later? (I also fixed the typo in the ChangeLog entry) If I hear nothing I will commit this weekend.

Jerry




Index: io/transfer.c
===================================================================
*** io/transfer.c	(revision 113213)
--- io/transfer.c	(working copy)
*************** formatted_transfer_scalar (st_parameter_
*** 670,676 ****
  
        f = next_format (dtp);
        if (f == NULL)
! 	return;	      /* No data descriptors left (already raised).  */
  
        /* Now discharge T, TR and X movements to the right.  This is delayed
  	 until a data producing format to suppress trailing spaces.  */
--- 670,682 ----
  
        f = next_format (dtp);
        if (f == NULL)
! 	{
! 	  /* No data descriptors left.  */
! 	  if (n > 0)
! 	    generate_error (&dtp->common, ERROR_FORMAT,
! 		"Missing data descriptor in format after reversion");
! 	  return;
! 	}
  
        /* Now discharge T, TR and X movements to the right.  This is delayed
  	 until a data producing format to suppress trailing spaces.  */

Attachment: fmt_exhaust.f90
Description: application/extension-f90


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