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]

[PATCH, libgfortran] Fix for PR24699, PR24700, PR24719]


First try spammed out. Trying again.

-------- Original Message --------
Subject: [PATCH, libgfortran] Fix for PR24699, PR24700, PR24719
Date: Wed, 09 Nov 2005 18:54:29 -0800
From: Jerry DeLisle <jvdelisle@verizon.net>
To: gcc-patches <gcc-patches@gcc.gnu.org>,  Fortran List <fortran@gcc.gnu.org>

The attached patch fixes the subject PR's.  I combined these because of the
degree of interaction going on.  There are two test cases attached also.  While
working through this I managed to break about 5 other test cases.  Part of the
patch is Georgy's suggestion.  I plan to do another test case later for PR24700,
  it is a little trickier to test and I think we ought to get these patches in
now and then I will add the case later.

This patch enables Polyhedron aermod.f90 to compile and run. (50000+ lines of code)

2005-11-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR libgfortran/24699, 24700, 24719
	* io/transfer.c (read_sf): Remove incorrect statement that was
	clearing bytes_left.
	(formatted_transfer_scalar): Add handling of end-of-record
	condition, setting values correctly to backup.
	(st_read): Initialize current_record.

None of my previous patches needed to be reverted.  The issues required proper
initialization and then handling the special case of end-of-record condition for
T format.  I plan to go back later and check the TR formatting for any thing
similar.

Please someone check this on a machine that uses CR-LF at end of line.  I think
its OK, but I would like to make sure.  I can't test for that.

OK for mainline?   OK for 4.0 branch? (with some minor changes, there is no
is_internal_unit() in 4.0 branch)

Regards,

Jerry

Index: transfer.c
===================================================================
--- transfer.c  (revision 106726)
+++ transfer.c  (working copy)
@@ -212,7 +212,6 @@
              return NULL;
            }

-         current_unit->bytes_left = 0;
          *length = n;
          sf_seen_eor = 1;
          break;
@@ -804,16 +803,23 @@
             trailing blanks are suppressed.  */
          if (g.mode == READING)
            {
-             if (skips > 0)
-               read_x (skips);
+             /* Adjust everything for end-of-record condition */
+             if (sf_seen_eor && !is_internal_unit())
+               {
+                 current_unit->bytes_left--;
+                 bytes_used = pos;
+                 sf_seen_eor = 0;
+                 skips--;
+               }
              if (skips < 0)
                {
                  move_pos_offset (current_unit->s, skips);
                  current_unit->bytes_left -= (gfc_offset)skips;
                  skips = pending_spaces = 0;
                }
+             else
+               read_x (skips);
            }
-
          break;

        case FMT_S:
@@ -1936,11 +1942,13 @@
          {
            generate_error (ERROR_END, NULL);
            current_unit->endfile = AFTER_ENDFILE;
+           current_unit->current_record = 0;
          }
        break;

       case AFTER_ENDFILE:
        generate_error (ERROR_ENDFILE, NULL);
+       current_unit->current_record = 0;
        break;
       }
 }

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

Attachment: pr24719.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]