This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, libfortran] PR 47007, 61847 Locale failures in libgfortran


On Wed, Nov 05, 2014 at 01:48:32PM +0200, Janne Blomqvist wrote:
> On Wed, Nov 5, 2014 at 1:07 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Wed, Nov 05, 2014 at 12:48:01PM +0200, Janne Blomqvist wrote:
> >> @@ -3528,6 +3533,11 @@ finalize_transfer (st_parameter_dt *dtp)
> >>    if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0)
> >>      *dtp->size = dtp->u.p.size_used;
> >>
> >> +#ifdef HAVE_USELOCALE
> >> +  if (dtp->u.p.old_locale != (locale_t) 0)
> >> +    uselocale (dtp->u.p.old_locale);
> >> +#endif
> >
> > I wonder if you shouldn't clear dtp->u.p.old_locale here too, so
> > that uselocale isn't called again.
> 
> Sure. In principle this shouldn't be needed, since IIRC the entire
> dtp->u.p structure is set to 0 when starting an IO operation,  but
> OTOH the cost is insignificant.

If finalize transfer is guaranteed to be called exactly once on
a structure on which dtp->u.p.old_locale has been set, then it is ok as is,
though clearing it after such an restoration operation is a good style;
you could e.g. then assert it is NULL when the done with a particular dtp
structure in debugging builds etc.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]