aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/transfer.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2017-12-03 03:26:09 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2017-12-03 03:26:09 +0000
commit7b39e3c24f912f274ea2127ca7fc3133bf97a911 (patch)
treeaf7bfb1c126c7ac0f9cba1f37be28fd90041d885 /libgfortran/io/transfer.c
parentacffd4fd6404bee31508007af5942192a78ab016 (diff)
downloadgcc-7b39e3c24f912f274ea2127ca7fc3133bf97a911.zip
gcc-7b39e3c24f912f274ea2127ca7fc3133bf97a911.tar.gz
gcc-7b39e3c24f912f274ea2127ca7fc3133bf97a911.tar.bz2
re PR fortran/83225 (runtime error in transfer.c)
2017-12-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/83225 * io/io.h (is_internal_unit): Use the unit_is_internal bit. * io/transfer.c (data_transfer_init): Set the bit to true for internal umits. Use that bit for checks for internal unit initializations. * io/unit.c (insert_unit): As a precaution, set the internal_unit_kind to zero when a unit structure is first created. From-SVN: r255362
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r--libgfortran/io/transfer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 1ac4c51..5429a85 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -2764,6 +2764,8 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
else
dtp->u.p.current_unit->has_size = false;
}
+ else if (dtp->u.p.current_unit->internal_unit_kind > 0)
+ dtp->u.p.unit_is_internal = 1;
/* Check the action. */
@@ -4085,7 +4087,7 @@ st_read_done (st_parameter_dt *dtp)
if (dtp->u.p.current_unit != NULL
&& dtp->u.p.current_unit->child_dtio == 0)
{
- if (is_internal_unit (dtp))
+ if (dtp->u.p.unit_is_internal)
{
if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
{
@@ -4099,7 +4101,7 @@ st_read_done (st_parameter_dt *dtp)
}
newunit_free (dtp->common.unit);
}
- if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
+ if (dtp->u.p.unit_is_internal || dtp->u.p.format_not_saved)
{
free_format_data (dtp->u.p.fmt);
free_format (dtp);
@@ -4156,7 +4158,7 @@ st_write_done (st_parameter_dt *dtp)
/* If this is a parent WRITE statement we do not need to retain the
internal unit structure for child use. */
- if (is_internal_unit (dtp))
+ if (dtp->u.p.unit_is_internal)
{
if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
{
@@ -4170,7 +4172,7 @@ st_write_done (st_parameter_dt *dtp)
}
newunit_free (dtp->common.unit);
}
- if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
+ if (dtp->u.p.unit_is_internal || dtp->u.p.format_not_saved)
{
free_format_data (dtp->u.p.fmt);
free_format (dtp);