Commit 13926b24 by Jerry DeLisle

re PR libfortran/77828 (Linking gfortran-7 compiled program with libgfortran of…

re PR libfortran/77828 (Linking gfortran-7 compiled program with libgfortran of 5.x allowed but crashes when containing write to string)

2016-10-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/77828
	* io/io.h (st_parameter_dt): Reorder for readability and sanity.
	* io/transfer.c (data_transfer_init): Remove TODO and enable the
	runtime error message, rec= specifier not allowed in STREAM
	access.
	* libtool-version: Bump major version of libgfortran to 4.

	* ioparm.def: Reorder dt parameters to match libgfortran.
	* libgfortran.h: Swap definitions of GFC_INTERNAL_UNIT and
	GFC_INTERNAL_UNIT4.

From-SVN: r241497
parent c7082171
2016-10-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/77828
* ioparm.def: Reorder dt parameters to match libgfortran.
* libgfortran.h: Swap definitions of GFC_INTERNAL_UNIT and
GFC_INTERNAL_UNIT4.
2016-10-24 Steven G. Kargl <kargl@gcc.gnu.org> 2016-10-24 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71895 PR fortran/71895
......
...@@ -90,11 +90,9 @@ IOPARM (inquire, id, 1 << 7, pint4) ...@@ -90,11 +90,9 @@ IOPARM (inquire, id, 1 << 7, pint4)
IOPARM (inquire, iqstream, 1 << 8, char1) IOPARM (inquire, iqstream, 1 << 8, char1)
IOPARM (wait, common, 0, common) IOPARM (wait, common, 0, common)
IOPARM (wait, id, 1 << 7, pint4) IOPARM (wait, id, 1 << 7, pint4)
#ifndef IOPARM_dt_list_format IOPARM (dt, common, 0, common)
#define IOPARM_dt_list_format (1 << 7) #define IOPARM_dt_list_format (1 << 7)
#define IOPARM_dt_namelist_read_mode (1 << 8) #define IOPARM_dt_namelist_read_mode (1 << 8)
#endif
IOPARM (dt, common, 0, common)
IOPARM (dt, rec, 1 << 9, intio) IOPARM (dt, rec, 1 << 9, intio)
IOPARM (dt, size, 1 << 10, pintio) IOPARM (dt, size, 1 << 10, pintio)
IOPARM (dt, iolength, 1 << 11, pintio) IOPARM (dt, iolength, 1 << 11, pintio)
...@@ -103,7 +101,6 @@ IOPARM (dt, format, 1 << 12, char1) ...@@ -103,7 +101,6 @@ IOPARM (dt, format, 1 << 12, char1)
IOPARM (dt, advance, 1 << 13, char2) IOPARM (dt, advance, 1 << 13, char2)
IOPARM (dt, internal_unit, 1 << 14, char1) IOPARM (dt, internal_unit, 1 << 14, char1)
IOPARM (dt, namelist_name, 1 << 15, char2) IOPARM (dt, namelist_name, 1 << 15, char2)
IOPARM (dt, u, 0, pad)
IOPARM (dt, id, 1 << 16, pint4) IOPARM (dt, id, 1 << 16, pint4)
IOPARM (dt, pos, 1 << 17, intio) IOPARM (dt, pos, 1 << 17, intio)
IOPARM (dt, asynchronous, 1 << 18, char1) IOPARM (dt, asynchronous, 1 << 18, char1)
...@@ -115,3 +112,4 @@ IOPARM (dt, round, 1 << 23, char2) ...@@ -115,3 +112,4 @@ IOPARM (dt, round, 1 << 23, char2)
IOPARM (dt, sign, 1 << 24, char1) IOPARM (dt, sign, 1 << 24, char1)
#define IOPARM_dt_f2003 (1 << 25) #define IOPARM_dt_f2003 (1 << 25)
#define IOPARM_dt_dtio (1 << 26) #define IOPARM_dt_dtio (1 << 26)
IOPARM (dt, u, 0, pad)
...@@ -70,8 +70,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -70,8 +70,8 @@ along with GCC; see the file COPYING3. If not see
/* Special unit numbers used to convey certain conditions. Numbers -4 /* Special unit numbers used to convey certain conditions. Numbers -4
thru -9 available. NEWUNIT values start at -10. */ thru -9 available. NEWUNIT values start at -10. */
#define GFC_INTERNAL_UNIT4 -1 /* KIND=4 Internal Unit. */ #define GFC_INTERNAL_UNIT -1 /* KIND=1 Internal Unit. */
#define GFC_INTERNAL_UNIT -2 /* KIND=1 Internal Unit. */ #define GFC_INTERNAL_UNIT4 -2 /* KIND=4 Internal Unit. */
#define GFC_INVALID_UNIT -3 #define GFC_INVALID_UNIT -3
/* Possible values for the CONVERT I/O specifier. */ /* Possible values for the CONVERT I/O specifier. */
......
! { dg-do run }
program stream_test
implicit none
integer :: ios
character(128) :: message
open(10, status='scratch', access='stream')
write (10, rec=1, iostat=ios, iomsg=message) "This is a test" !
if (ios.ne.5001) call abort
if (message.ne. &
&"Record number not allowed for stream access data transfer") &
call abort
end program
2016-10-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/77828
* io/io.h (st_parameter_dt): Reorder for readability and sanity.
* io/transfer.c (data_transfer_init): Remove TODO and enable the
runtime error message, rec= specifier not allowed in STREAM
access.
* libtool-version: Bump major version of libgfortran to 4.
2016-10-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2016-10-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/78055 PR libfortran/78055
......
...@@ -424,6 +424,15 @@ typedef struct st_parameter_dt ...@@ -424,6 +424,15 @@ typedef struct st_parameter_dt
CHARACTER2 (advance); CHARACTER2 (advance);
CHARACTER1 (internal_unit); CHARACTER1 (internal_unit);
CHARACTER2 (namelist_name); CHARACTER2 (namelist_name);
GFC_INTEGER_4 *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 /* Private part of the structure. The compiler just needs
to reserve enough space. */ to reserve enough space. */
union union
...@@ -440,7 +449,8 @@ typedef struct st_parameter_dt ...@@ -440,7 +449,8 @@ typedef struct st_parameter_dt
unit_blank blank_status; unit_blank blank_status;
unit_sign sign_status; unit_sign sign_status;
int scale_factor; int scale_factor;
int max_pos; /* Maximum righthand column written to. */ /* Maximum righthand column written to. */
int max_pos;
/* Number of skips + spaces to be done for T and X-editing. */ /* Number of skips + spaces to be done for T and X-editing. */
int skips; int skips;
/* Number of spaces to be done for T and X-editing. */ /* Number of spaces to be done for T and X-editing. */
...@@ -494,8 +504,7 @@ typedef struct st_parameter_dt ...@@ -494,8 +504,7 @@ typedef struct st_parameter_dt
are an unsigned char, EOF, or EOF - 1 used to mark the are an unsigned char, EOF, or EOF - 1 used to mark the
field as not valid. */ field as not valid. */
int last_char; /* No longer used, moved to gfc_unit. */ int last_char; /* No longer used, moved to gfc_unit. */
char nml_delim; int nml_delim;
int repeat_count; int repeat_count;
int saved_length; int saved_length;
int saved_used; int saved_used;
...@@ -523,15 +532,6 @@ typedef struct st_parameter_dt ...@@ -523,15 +532,6 @@ typedef struct st_parameter_dt
must be smaller or equal to this array. */ must be smaller or equal to this array. */
char pad[16 * sizeof (char *) + 32 * sizeof (int)]; char pad[16 * sizeof (char *) + 32 * sizeof (int)];
} u; } u;
GFC_INTEGER_4 *id;
GFC_IO_INT pos;
CHARACTER1 (asynchronous);
CHARACTER2 (blank);
CHARACTER1 (decimal);
CHARACTER2 (delim);
CHARACTER1 (pad);
CHARACTER2 (round);
CHARACTER1 (sign);
} }
st_parameter_dt; st_parameter_dt;
......
...@@ -3026,20 +3026,13 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -3026,20 +3026,13 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
return; return;
} }
/* TODO: This is required to maintain compatibility between
4.3 and 4.4 runtime. Remove when ABI changes from 4.3 */
if (is_stream_io (dtp))
dtp->u.p.current_unit->strm_pos = dtp->rec;
/* TODO: Un-comment this code when ABI changes from 4.3.
if (dtp->u.p.current_unit->flags.access == ACCESS_STREAM) if (dtp->u.p.current_unit->flags.access == ACCESS_STREAM)
{ {
generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT, generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
"Record number not allowed for stream access " "Record number not allowed for stream access "
"data transfer"); "data transfer");
return; return;
} */ }
} }
/* Bugware for badly written mixed C-Fortran I/O. */ /* Bugware for badly written mixed C-Fortran I/O. */
......
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
# This is a separate file so that version updates don't involve re-running # This is a separate file so that version updates don't involve re-running
# automake. # automake.
# CURRENT:REVISION:AGE # CURRENT:REVISION:AGE
3:0:0 4:0:0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment