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: [gfortran] Replace gfc_symtree in gfc_expr by gfc_symbol


On Monday 07 June 2004 14:07, Tobias Schlüter wrote:
> Since I will touch some of the expression handling code for the
> artificial variable work, I thought I'd do something first which I had
> planned to do for a while: this patch replaces the gfc_symtree *symtree
> in gfc_expr by a gfc_symbol.

Unfortunately I added this extra level of indirection for a reason :)
When we parse a contained function we don't know which symbols may also be 
contained functions with the same host. After parsing a function we use  
gfc_fixup_sibling to insert it into previously parsed functions. 

Maybe it's not the best solution, but it's the only one we thought of that 
didn't involve rewriting large chunks of the frontend.

I forgot to add a testcase. Rectified this as follows.

Paul

2004-06-12  Paul Brook  <paul@codesourcery.com>

	* gfortran.fortran-torture/execute/contained_3.f90: New test.

! Program to test contained functions calling their siblings.
! This is tricky because we don't find the declaration for the sibling
! function until after the caller has been parsed.
program contained_3
  call test
contains
  subroutine test
    if (sub(3) .ne. 6) call abort
  end subroutine
  integer function sub(i)
    integer i
    if (i .gt. 1) then
      sub = sub2(i) * i
    else
      sub = 1
    end if
  end function
  integer function sub2(i)
    integer i
    sub2 = sub(i - 1)
  end function
end program


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