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]

bug or wrong in my program?


Hello.
Now, I'm no fortran95 expert, but as far as I know, this should be an ok 
fortran 95 program:
(but at the line I have marked HERE at the end of the message, I get the  
compilation error:below.
( I use  GNU Fortran 95 (GCC 4.0.0 20050115 (experimental)))
If I uncomment the "Area" part it compiles and runs perfectly! 


 In file ex1.f95:18

 REAL :: a,b,c, Area
                   1
Error: Symbol 'area' at (1) already has basic type of REAL
 In file ex1.f95:21

 read*,a,b,c
         1
Error: Symbol 'b' at (1) has no IMPLICIT type
 In file ex1.f95:21

 read*,a,b,c
       1
Error: Symbol 'a' at (1) has no IMPLICIT type
 In file ex1.f95:21

 read*,a,b,c
           1
Error: Symbol 'c' at (1) has no IMPLICIT type
 In file ex1.f95:21

 read*,a,b,c
       1
Error: Symbol 'a' at (1) has no IMPLICIT type
 In file ex1.f95:21

 read*,a,b,c
         1
Error: Symbol 'b' at (1) has no IMPLICIT type
 In file ex1.f95:21

 read*,a,b,c
           1
Error: Symbol 'c' at (1) has no IMPLICIT type
 In file ex1.f95:21

 read*,a,b,c
       1
Error: Symbol 'a' at (1) has no IMPLICIT type
======================================================


MODULE Triangle_Operations
 IMPLICIT none
 CONTAINS

 FUNCtION Area(x,y,z)
  real :: area ! function type
  real, intent(in) :: x,y,z
  real :: theta, height
  theta=acos((x**2+y**2-z**2)/(2.0*x*y))
  height = x*sin(theta); area=0.5*y*height
 END FUNCTion area
end module Triangle_Operations

program Triangle
 use triangle_operations
 implicit none
 
 REAL :: a,b,c, Area  ! <<<<<<<<<-----------HERE!!!!!
 print*, 'Hej och hå, skriv in &
   & längderna på de tri siderna: '
 read*,a,b,c
 print*,'Triangel arean = ',Area(a,b,c)
end program triangle


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