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] | |
Attached patch fixes PR 16436: TL edit descriptors were incorectly handled, and thus f77-edit-t-in.f from the g77 testsuite was XFAILed. Patch makes this testcase work, and repairs the broken handling of the "bytes_left" of units and the "active" parameter of streams. Patch also contains some whitespace corrections. Regtested on i686-linux. OK for mainline and 4.0?
Index: libgfortran/io/transfer.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/transfer.c,v
retrieving revision 1.42
diff -p -u -r1.42 transfer.c
--- libgfortran/io/transfer.c 29 May 2005 12:22:49 -0000 1.42
+++ libgfortran/io/transfer.c 31 May 2005 12:28:02 -0000
@@ -160,7 +160,6 @@ read_sf (int *length)
return base;
}
- current_unit->bytes_left = options.default_recl;
readlen = 1;
n = 0;
@@ -214,6 +213,7 @@ read_sf (int *length)
sf_seen_eor = 0;
}
while (n < *length);
+ current_unit->bytes_left -= *length;
if (ioparm.size != NULL)
*ioparm.size += *length;
@@ -675,22 +675,19 @@ formatted_transfer (bt type, void *p, in
case FMT_TL:
case FMT_T:
- if (f->format==FMT_TL)
- {
- pos = f->u.n ;
- pos= current_unit->recl - current_unit->bytes_left - pos;
- }
- else // FMT==T
+ if (f->format == FMT_TL)
+ pos = current_unit->recl - current_unit->bytes_left - f->u.n;
+ else /* FMT_T */
{
- consume_data_flag = 0 ;
- pos = f->u.n - 1;
+ consume_data_flag = 0;
+ pos = f->u.n - 1;
}
if (pos < 0 || pos >= current_unit->recl )
- {
- generate_error (ERROR_EOR, "T Or TL edit position error");
- break ;
- }
+ {
+ generate_error (ERROR_EOR, "T Or TL edit position error");
+ break ;
+ }
m = pos - (current_unit->recl - current_unit->bytes_left);
if (m == 0)
@@ -707,6 +704,7 @@ formatted_transfer (bt type, void *p, in
if (m < 0)
{
move_pos_offset (current_unit->s,m);
+ current_unit->bytes_left -= m;
}
break;
Index: libgfortran/io/unix.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.27
diff -p -u -r1.27 unix.c
--- libgfortran/io/unix.c 30 May 2005 07:38:36 -0000 1.27
+++ libgfortran/io/unix.c 31 May 2005 12:28:02 -0000
@@ -154,26 +154,22 @@ move_pos_offset (stream* st, int pos_off
unix_stream * str = (unix_stream*)st;
if (pos_off < 0)
{
- str->active += pos_off;
- if (str->active < 0)
- str->active = 0;
+ str->logical_offset += pos_off;
- str->logical_offset += pos_off;
-
- if (str->dirty_offset+str->ndirty > str->logical_offset)
+ if (str->dirty_offset + str->ndirty > str->logical_offset)
{
- if (str->ndirty + pos_off > 0)
- str->ndirty += pos_off ;
+ if (str->ndirty + pos_off > 0)
+ str->ndirty += pos_off;
else
{
str->dirty_offset += pos_off + pos_off;
- str->ndirty = 0 ;
+ str->ndirty = 0;
}
}
- return pos_off ;
+ return pos_off;
}
- return 0 ;
+ return 0;
}
Index: gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f,v
retrieving revision 1.1
diff -p -u -r1.1 f77-edit-t-in.f
--- gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f 8 Jul 2004 23:36:52 -0000 1.1
+++ gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f 31 May 2005 12:35:24 -0000
@@ -3,7 +3,7 @@ C (ANSI X3.9-1978 Section 13.5.3.2)
C
C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
C
-C { dg-do run {xfail *-*-*} } gfortran PR 16436
+C { dg-do run }
integer i,j
real a,b,c,d,e
character*32 in
Attachment:
pr16436.ChangeLog
Description: Binary data
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |