[PATCH] PR fortran/24005

Steve Kargl sgk@troutmask.apl.washington.edu
Thu Sep 22 20:59:00 GMT 2005


The attach patch appears to fix the problem discussed in
PR fortran/24005.  I have bootstrap and regression tested
the patch on freebsd7-*-amd64.

Note, the testcase was distilled from the MPFUN90 library
that is freely available on the internet.  With this patch,
I can now compile MPFUN90 and successfully run its tes program.

The problem, again discussed in the PR, is that gfortran was
passing a NULL pointer to strcmp.

OK for mainline?

-- 
Steve
-------------- next part --------------
Index: interface.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/interface.c,v
retrieving revision 1.19
diff -c -p -r1.19 interface.c
*** interface.c	25 Jun 2005 00:40:34 -0000	1.19
--- interface.c	22 Sep 2005 19:45:32 -0000
*************** check_interface1 (gfc_interface * p, gfc
*** 926,932 ****
  	if (p->sym == q->sym)
  	  continue;		/* Duplicates OK here */
  
! 	if (strcmp (p->sym->name, q->sym->name) == 0
  	    && strcmp (p->sym->module, q->sym->module) == 0)
  	  continue;
  
--- 926,933 ----
  	if (p->sym == q->sym)
  	  continue;		/* Duplicates OK here */
  
! 	if (p->sym->name && q->sym->name && p->sym->module && q->sym->module
! 	    && strcmp (p->sym->name, q->sym->name) == 0
  	    && strcmp (p->sym->module, q->sym->module) == 0)
  	  continue;
  
-------------- next part --------------
! { dg-do compile }
! This program would segfault without the patch for PR fortran/24005.
module y
  !
  ! If private statement is removed, then we get a bunch of errors
  !
  private f
  !
  ! If we rename 'f' in module y to say 'g', then gfortran correctly
  ! identifies ambiguous as being ambiguous.
  !
  interface ambiguous
    module procedure f
  end interface

  contains

    real function f(a)
      real a
      f = a
    end function

end module y

module z

  use y

  interface ambiguous
    module procedure f    ! { dg-error "in generic interface" "" }
  end interface

  contains

    real function f(a)
      real a
      f = a
    end function

end module z


More information about the Fortran mailing list