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]

[patch, libgfortran] PR43265 Follow-up 1


Greetings,

This patch allows the test case to run as discussed in the PR.

Regression tested on x86-64. OK for trunk?

Jerry

2010-03-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR libfortran/43265
	* io/transfer.c (read_block_form): Return empty string for internal
	unit.

Index: transfer.c
===================================================================
--- transfer.c	(revision 157393)
+++ transfer.c	(working copy)
@@ -338,6 +338,7 @@ read_sf (st_parameter_dt *dtp, int * length)
 void *
 read_block_form (st_parameter_dt *dtp, int * nbytes)
 {
+  static char *empty_string[0];
   char *source;
   int norig;

@@ -362,7 +363,9 @@ read_block_form (st_parameter_dt *dtp, int * nbyte

 	  if (unlikely (dtp->u.p.current_unit->bytes_left == 0))
 	    {
-              hit_eof (dtp);
+	      if (is_internal_unit (dtp) && dtp->internal_unit_len == 0)
+		return empty_string;
+	      hit_eof (dtp);
 	      return NULL;
 	    }



 ! { dg-do run }
 ! PR43265 Follow-up, read from empty string.
      character(len=2) str
      str = ''
      read(str(1:0), '(T7,i1)') i
      if (i /= 0) call abort
      end


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