diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2017-07-07 16:01:24 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2017-07-07 16:01:24 +0200 |
commit | 6b949707cb585a4acced74a912739f26dea33820 (patch) | |
tree | f913afb9b3f6cd17f124d2e69f7e01d1273b3507 /libgfortran | |
parent | 0c7d6c4a218b7802e62cadce6e42f9c2544abd67 (diff) |
Merge branches/gcc-7-branch rev 250046.
Change-Id: Iab4acacc1408cb2f8e03dd1d07ec9241c762f83a
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 14 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 5 | ||||
-rw-r--r-- | libgfortran/io/unit.c | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index ca109865be3..bf788e520fd 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,17 @@ +2017-06-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk + PR libgfortran/53029 + * io/list_read.c(list_formatted_read_scalar: Set the err return + value to the common.flags error values. + +2017-06-26 Jim Wilson <jim.wilson@r3-a15.aus-colo> + + Backport from trunk + PR libfortran/81195 + * io/unit.c (get_unit): Call __gthread_mutex_lock before newunit_stack + and newunit_tos references. Call __gthread_mutex_unlock afterward. + 2017-06-06 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 24584fa9930..943afb51c6a 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2298,11 +2298,16 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p, free_saved (dtp); cleanup: + /* err may have been set above from finish_separator, so if it is set + trigger the hit_eof. The hit_eof will set bits in common.flags. */ if (err == LIBERROR_END) { free_line (dtp); hit_eof (dtp); } + /* Now we check common.flags for any errors that could have occurred in + a READ elsewhere such as in read_integer. */ + err = dtp->common.flags & IOPARM_LIBRETURN_MASK; fbuf_flush_list (dtp->u.p.current_unit, LIST_READING); return err; } diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index bcc1e37e2e3..ef94294526a 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -583,14 +583,17 @@ get_unit (st_parameter_dt *dtp, int do_create) } else { + __gthread_mutex_lock (&unit_lock); if (newunit_tos) { dtp->common.unit = newunit_stack[newunit_tos].unit_number; unit = newunit_stack[newunit_tos--].unit; + __gthread_mutex_unlock (&unit_lock); unit->fbuf->act = unit->fbuf->pos = 0; } else { + __gthread_mutex_unlock (&unit_lock); dtp->common.unit = newunit_alloc (); unit = xcalloc (1, sizeof (gfc_unit)); fbuf_init (unit, 128); @@ -603,12 +606,15 @@ get_unit (st_parameter_dt *dtp, int do_create) /* If an internal unit number is passed from the parent to the child it should have been stashed on the newunit_stack ready to be used. Check for it now and return the internal unit if found. */ + __gthread_mutex_lock (&unit_lock); if (newunit_tos && (dtp->common.unit <= NEWUNIT_START) && (dtp->common.unit == newunit_stack[newunit_tos].unit_number)) { unit = newunit_stack[newunit_tos--].unit; + __gthread_mutex_unlock (&unit_lock); return unit; } + __gthread_mutex_unlock (&unit_lock); /* Has to be an external unit. */ dtp->u.p.unit_is_internal = 0; |