Broken gfortran ABI - rfc
Jerry DeLisle
jvdelisle@verizon.net
Sun Sep 14 03:20:00 GMT 2008
Hi all,
Here is where I am stuck.
Reordering the st_parameter_dt structure in libgfortran/io/io.h as shown in
below patch brings 4.3 executables back into happiness. All of 4.4 also works
fine except the new f2003_io_*.f03 test cases which rely on the following
elements of the structure being placed correctly when the st_parameter_dt
structure type is built.
GFC_IO_INT *id;
GFC_IO_INT pos;
CHARACTER1 (asynchronous);
CHARACTER2 (blank);
CHARACTER1 (decimal);
CHARACTER2 (delim);
CHARACTER1 (pad);
CHARACTER2 (round);
CHARACTER1 (sign);
My first thoughts were to reorder the definitions in fortran/ioparm.def.
ioparm.def is used to create an array of st_parameter_field types. This array
is scanned to build the st_parameter_dt struct type.
When I do this, the -fdump-tree-original looks fine, but the everything in the
area from *id to sign (see list above) is garbage.
I belive the st_parameter_dt type is not getting defined correctly, but I do not
know where to go from here. Ideas?
Jerry
Simple test case:
real :: a(4), b(4)
real :: c
integer :: istat, j
character(25) :: msg
a = 23.45
b = 0.0
open(10, file='mydata', asynchronous="yes", blank="null")
write(10,'(10f8.3)', asynchronous="yes", decimal="point", id=j) a
end
Results in:
$ ./a.out
At line 13 of file f2003_io_1.f03 (unit = 10, file = 'mydata')
Fortran runtime error: Bad DECIMAL parameter in data transfer statement
The patch so far.
Index: io.h
===================================================================
--- io.h (revision 140070)
+++ io.h (working copy)
@@ -381,15 +381,6 @@ typedef struct st_parameter_dt
CHARACTER2 (advance);
CHARACTER1 (internal_unit);
CHARACTER2 (namelist_name);
- GFC_IO_INT *id;
- GFC_IO_INT pos;
- CHARACTER1 (asynchronous);
- CHARACTER2 (blank);
- CHARACTER1 (decimal);
- CHARACTER2 (delim);
- CHARACTER1 (pad);
- CHARACTER2 (round);
- CHARACTER1 (sign);
/* Private part of the structure. The compiler just needs
to reserve enough space. */
union
@@ -404,7 +395,6 @@ typedef struct st_parameter_dt
int item_count;
unit_mode mode;
unit_blank blank_status;
- unit_pad pad_status;
enum { SIGN_S, SIGN_SS, SIGN_SP } sign_status;
int scale_factor;
int max_pos; /* Maximum righthand column written to. */
@@ -418,8 +408,6 @@ typedef struct st_parameter_dt
2 if an EOR was encountered due to a 2-bytes marker (CRLF) */
int sf_seen_eor;
unit_advance advance_status;
- unit_decimal decimal_status;
- unit_delim delim_status;
unsigned reversion_flag : 1; /* Format reversion has occurred. */
unsigned first_item : 1;
@@ -474,12 +462,24 @@ typedef struct st_parameter_dt
kind. */
char value[32];
gfc_offset size_used;
+ unit_pad pad_status;
+ unit_decimal decimal_status;
+ unit_delim delim_status;
} p;
/* This pad size must be equal to the pad_size declared in
trans-io.c (gfc_build_io_library_fndecls). The above structure
must be smaller or equal to this array. */
char pad[16 * sizeof (char *) + 32 * sizeof (int)];
} u;
+ GFC_IO_INT *id;
+ GFC_IO_INT pos;
+ CHARACTER1 (asynchronous);
+ CHARACTER2 (blank);
+ CHARACTER1 (decimal);
+ CHARACTER2 (delim);
+ CHARACTER1 (pad);
+ CHARACTER2 (round);
+ CHARACTER1 (sign);
}
st_parameter_dt;
Index: ioparm.def
===================================================================
--- ioparm.def (revision 140070)
+++ ioparm.def (working copy)
@@ -83,6 +83,7 @@ IOPARM (dt, format, 1 << 12, char1)
IOPARM (dt, advance, 1 << 13, char2)
IOPARM (dt, internal_unit, 1 << 14, char1)
IOPARM (dt, namelist_name, 1 << 15, char2)
+IOPARM (dt, u, 0, pad)
IOPARM (dt, id, 1 << 16, pint4)
IOPARM (dt, pos, 1 << 17, intio)
IOPARM (dt, asynchronous, 1 << 18, char1)
@@ -92,4 +93,3 @@ IOPARM (dt, delim, 1 << 21, char2)
IOPARM (dt, pad, 1 << 22, char1)
IOPARM (dt, round, 1 << 23, char2)
IOPARM (dt, sign, 1 << 24, char1)
-IOPARM (dt, u, 0, pad)
More information about the Fortran
mailing list