[Bug fortran/30487] New: Math implicit function in forall statement causes compiler error

icksa1 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 16 20:33:00 GMT 2007


Hi:
I noticed that whenever I use a math function (such as sqrt, cos, log) in a
forall all statement that further uses of that function caused gfortran to say
that the function has no implicit type. I've shown an example program below:

program test

  implicit none

  integer :: i
  real :: a, c(5) = (/1.0,2.0,3.0,4.0,5.0/), d(5)

  a = sqrt(2.0)

  d(:) = 0.0

  forall (i = 1:5, sqrt(c(i)) < 2.0)
     d(i) = i
  end forall

end program test


If I try to compile the above program I get the following error:

 In file test.f90:8

  a = sqrt(2.0)
         1
Error: Symbol 'sqrt' at (1) has no IMPLICIT type

If I comment out the line "a = sqrt(2.0)", everything works fine. Also, if I
don't use the sqrt test in the forall statement, everything works fine. If you
substitute other mathematical functions for sqrt (such as log or cos) it fails
to compile in a similar way.

I tried this in the latest experimental build (downloaded from the gfortran
wiki) and had similar problems.

Thank You


-- 
           Summary: Math implicit function in forall statement causes
                    compiler error
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: icksa1 at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list