This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,libgfortran] PR32456 regression on darwin
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 Jun 2007 23:11:05 -0700
- Subject: [patch,libgfortran] PR32456 regression on darwin
:ADDPATCH fortran:
Hi,
Based on reported success of the attached patch from users and full regression
testing on x86-64, I plan to commit the attached patch tomorrow to trunk.
The fixed approach avoids calling find_unit which gets into a bunch of mutex
lock code. Since all we are doing is getting the filename out of the unit
structure, I extracted a short snippet from get_external_unit to do the deed.
Regards,
Jerry
2007-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32456
* io/unit.c (filename_from_unit): Don't use find_unit, instead search
for unit directly.
Index: io/unit.c
===================================================================
*** io/unit.c (revision 126079)
--- io/unit.c (working copy)
*************** update_position (gfc_unit *u)
*** 690,700 ****
must free memory allocated for the filename string. */
char *
! filename_from_unit (int unit_number)
{
char *filename;
! gfc_unit *u = NULL;
! u = find_unit (unit_number);
if (u != NULL)
{
filename = (char *) get_mem (u->file_len + 1);
--- 690,715 ----
must free memory allocated for the filename string. */
char *
! filename_from_unit (int n)
{
char *filename;
! gfc_unit *u;
! int c;
!
! /* Find the unit. */
! u = unit_root;
! while (u != NULL)
! {
! c = compare (n, u->unit_number);
! if (c < 0)
! u = u->left;
! if (c > 0)
! u = u->right;
! if (c == 0)
! break;
! }
!
! /* Get the filename. */
if (u != NULL)
{
filename = (char *) get_mem (u->file_len + 1);
*************** filename_from_unit (int unit_number)
*** 703,706 ****
}
else
return (char *) NULL;
! }
\ No newline at end of file
--- 718,722 ----
}
else
return (char *) NULL;
! }
!