[RFC PATCH] _gfortran_{ioparm,filename,line} vs. thread-safety

Jakub Jelinek jakub@redhat.com
Wed Oct 5 13:09:00 GMT 2005


On Wed, Oct 05, 2005 at 12:24:09PM +0300, Janne Blomqvist wrote:
> I think this if statement could be replaced with something like
> 
> if (m > s->file_length)
>   {
>     *len = s->file_length - where;
>     return NULL;
>   }
> 
> and then call generate_error in the calling function. That way there
> would be no need to add the st_parameter_dt argument to salloc_w_at,
> preserving the "purity" of the IO API.

Good idea, added to my tree.  There is a slight difference though,
the generate_error was called with ERROR_END while the callers, if
they ever check the return value (some of them don't :( ) use
ERROR_OS.  So, if none of IOSTAT=, ERR=, END= is used, there might be
a difference in the message wording (guess no big deal).
Otherwise generate_error will return, therefore sallow_w* return NULL
and the caller generate_error again, this time with ERROR_OS.
For IOSTAT= alone, that means your proposed solution makes no difference
at all, for ERR=, END= it is only improvement (same behaviour unless
only ERR= alone is specified, in which case before it would die and
now it will just branch to the err label).

	Jakub



More information about the Fortran mailing list