diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1d4e62434ac..6e77d53961b 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,7 @@ +2017-12-02 Jerry DeLisle + + PR libgfortran/83191 + 2017-12-02 Jerry DeLisle PR libgfortran/83225 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 3c03a02cad8..379050cecad 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2099,8 +2099,6 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p, int c, i, m; int err = 0; - dtp->u.p.namelist_mode = 0; - /* Set the next_char and push_char worker functions. */ set_workers (dtp); @@ -3546,7 +3544,6 @@ namelist_read (st_parameter_dt *dtp) name. */ namelist_info *prev_nl = NULL; - dtp->u.p.namelist_mode = 1; dtp->u.p.input_complete = 0; dtp->u.p.expanded_read = 0; diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 5429a855541..4d7ca7abf7b 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2671,7 +2671,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) dtp->u.p.ionml = ionml; dtp->u.p.mode = read_flag ? READING : WRITING; - + dtp->u.p.namelist_mode = 0; dtp->u.p.cc.len = 0; if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK) @@ -3890,6 +3890,7 @@ finalize_transfer (st_parameter_dt *dtp) if ((dtp->u.p.ionml != NULL) && (cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0) { + dtp->u.p.namelist_mode = 1; if ((cf & IOPARM_DT_NAMELIST_READ_MODE) != 0) namelist_read (dtp); else diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 582d196c4e3..926d510f4d7 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1809,9 +1809,11 @@ write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size) precision, buf_size, result1, &res_len1); get_float_string (dtp, &f, source + size / 2 , kind, 0, buffer, precision, buf_size, result2, &res_len2); - lblanks = width - res_len1 - res_len2 - 3; - - write_x (dtp, lblanks, lblanks); + if (!dtp->u.p.namelist_mode) + { + lblanks = width - res_len1 - res_len2 - 3; + write_x (dtp, lblanks, lblanks); + } write_char (dtp, '('); write_float_string (dtp, result1, res_len1); write_char (dtp, semi_comma);