[PATCH] Thread-safe libgfortran (PRs fortran/14943 and fortran/21647)
Alan Modra
amodra@bigpond.net.au
Wed Nov 23 08:17:00 GMT 2005
On Wed, Nov 23, 2005 at 07:47:32AM +0100, FX Coudert wrote:
> >Is this an AIX specific problem? I won't have time
> >until tomorrow (10 hours from now) to investigate.
>
> No, it isn't. I won't have time now either (stupid public transportation
> strike).
To make the review easier, here's the supporting evidence that my patch
is correct. Jakub's patch did
- u = find_file ();
- if (u != NULL
+ u2 = NULL;
+ if ((opp->common.flags & IOPARM_OPEN_HAS_FILE) != 0)
+ u2 = find_file (opp->file, opp->file_len);
+ if (u2 != NULL
&& (options.stdin_unit < 0 || u->unit_number != options.stdin_unit)
&& (options.stdout_unit < 0 || u->unit_number != options.stdout_unit)
&& (options.stderr_unit < 0 || u->unit_number != options.stderr_unit
ie. before Jakub's patch, u was the same as the new u2, the gfc_unit of
an already open file. u is now the new gfc_unit passed in from st_open.
And, just to make it obvious,
(gdb) p *u2
$6 = {unit_number = 5, s = 0x100af640, left = 0x0, right = 0x0,
priority = 10821, read_bad = 0, current_record = 0, endfile = NO_ENDFILE,
mode = READING, flags = {access = ACCESS_SEQUENTIAL, action = ACTION_READ,
blank = BLANK_UNSPECIFIED, delim = DELIM_NONE, form = FORM_FORMATTED,
is_notpadded = 0, position = POSITION_ASIS, status = STATUS_OLD,
pad = PAD_YES}, recl = 1073741824, last_record = 0, maxrec = 0,
bytes_left = 0, lock = {__m_reserved = 0, __m_count = 0, __m_owner = 0x0,
__m_kind = 0, __m_lock = {__status = 0, __spinlock = 0}}, waiting = 0,
closed = 0, ls = 0x0, rank = 0, file_len = 0, file = 0x0}
(gdb) p *u
$7 = {unit_number = 10, s = 0x0, left = 0x0, right = 0x0, priority = 14047,
read_bad = 0, current_record = 0, endfile = NO_ENDFILE, mode = READING,
flags = {access = ACCESS_SEQUENTIAL, action = ACTION_READ,
blank = BLANK_NULL, delim = DELIM_NONE, form = FORM_FORMATTED,
is_notpadded = 0, position = POSITION_ASIS, status = STATUS_UNKNOWN,
pad = PAD_YES}, recl = 0, last_record = 0, maxrec = 0, bytes_left = 0,
lock = {__m_reserved = 0, __m_count = 0, __m_owner = 0x0, __m_kind = 0,
__m_lock = {__status = 0, __spinlock = 0}}, waiting = 0, closed = 0,
ls = 0x0, rank = 0, file_len = 0, file = 0x0}
(gdb) p *(options_t *)$r11 (don't ask me why p options didn't work!)
$8 = {stdin_unit = 5, stdout_unit = 6, stderr_unit = 0, optional_plus = 0,
allocate_init_flag = 0, allocate_init_value = 0, locus = 1,
separator_len = 1, separator = 0x1008c348 " ", mem_check = 0,
use_stderr = 1, all_unbuffered = 0, default_recl = 1073741824,
fpu_round = 0, fpu_precision = 0, fpe = 0, sighup = 0, sigint = 0}
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Fortran
mailing list