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: [Patch, Fortran] PR 39577 - fix -fcheck=recursion


Tobias,

With your patch, the false positive in pr39577 disappears, but I have dozen
"Recursive call to nonrecursive procedure" on my bug collection for which I
am not so sure about the validity of the error.  From a first look, they
seem to be the same that cause ICEs with the Paul's '-fwhole-file' flag, so
you can find two examples at

http://gcc.gnu.org/ml/fortran/2009-03/msg00316.html
http://gcc.gnu.org/ml/fortran/2009-03/msg00317.html

I doubt they are standard conforming.  If they are not, gfortran can do
whatever is deemed suitable, including the error.  I have tried to make the
second test standard conforming as:

recursive function fac(i) result (res)
  integer :: i, j, k, res
  k = 1
  goto 100
entry bifac(i,j) result (res)
  k = j
100 continue
  if (i < k) then
    res = 1
  else
    res = i * bifac(i-k,k)
  end if
end function

program test
interface
  recursive function fac(n) result (res)
    integer :: res
    integer :: n
  end function fac
  recursive function bifac(m,n) result (res)
    integer :: m, n, res
  end function  bifac
end interface

  print *, fac(5)
  print *, bifac(5,2)
  print*, fac(6)
  print *, bifac(6,2)
  print*, fac(0)
  print *, bifac(1,2)
end program test

I am not so sure because I don't really master 'recursive', 'entry', and
interfaces.  But, if the code above is standard conforming, then it is a
false positive.

Thanks for the patch,

Dominique


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