This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

ICE on invalid on function used as variable


Calling a function without the trailing () causes an ICE in gfortran 4.7.0
(r180805). For example:

module Test_Mod
  implicit none
  private

contains

  double precision function Func1()
    implicit none
    Func1=Func2
    return
  end function Func1

  double precision function Func2(arg1)
    implicit none
    double precision, intent(in) :: arg1
    Func2=arg1
  end function Func2

end module Test_Mod

$ gfortran -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.7/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7/libexec/gcc/i686-pc-linux-
gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.7/configure --prefix=/usr/local/gcc-4.7
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.7.0 20111102 (experimental) (GCC) 


$ gfortran -c test.F90 -o test.o
test.F90: In function âfunc1â:
test.F90:7:0: error: invalid types in conversion to floating point
real(kind=8)
real(kind=8) (*<T44f>) (real(kind=8) & restrict)
__result_func1.0 = (real(kind=8)) func2;

test.F90:7:0: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Adding () to the call to Func2 correctly results in an error being reported.

This bug seems similar to Bug 40678
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40678 which was present in 4.1, 
4.2 and 4.3 but went away in 4.4 and 4.5 (not sure about 4.6).

I've opened a PR for this:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50974

-Andrew.

-- 

* Andrew Benson: http://www.tapir.caltech.edu/~abenson/contact.html

* Galacticus: http://sites.google.com/site/galacticusmodel


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