Re: fortran 90/95 standard




Patrick Begou schreef:

> I've a small question about fortran 90/95 standard:
>
> I've a function using implicit types:

First: try to avoid implicit typing :-)

> SUBROUTINE eval(nx,nz,i,k,neq,u,vec)
> IMPLICIT REAL (a-h,o-z)
> IMPLICIT INTEGER (i-n)
> COMMON /use1/ mx,my,nd
> .....
> END SUBROUTINE eval
>
> Using gfortran (gcc-gfortran-4.0.1-4.fc4) it compiles but, puting this
> function in a module with "implicit none" do not compile ("variable my
> has no type"):
>
> MODULE mod_avanti_e
>
> IMPLICIT NONE
>
> CONTAINS
>
> SUBROUTINE eval(nx,nz,i,k,neq,u,vec)
> IMPLICIT REAL (a-h,o-z)
> IMPLICIT INTEGER (i-n)
> COMMON /use1/ mx,my,nd
> .....
> END SUBROUTINE eval
>
> END MODULE mod_avanti_e
>
> This occur with gfortran but not with intel compiler nor IBM xlf
> compiler. Is it normal behavior (gfortran beeing more strict about
> fortran language) or an error in the compiler ?

This must be a bug in the compiler. The code is correct.

> I'm porting a big fortran 77 code in fortran90/95 ans there are a lot of
> such subroutine to rewrite in "implicit none".... and it needs time!

It may be worthwhile to add IMPLICIT NONE and declare all vaiables
explicitly , gradually...

[JvO]

.



Relevant Pages

  • Re: goto, again
    ... I am, as you understand, no particular fan of fortran. ... When passing a literal value "1" to a function or subroutine it gets passed by reference. ... I've not seen a modern compiler that would do that in some 20 years or more... ... implicit none ...
    (comp.soft-sys.matlab)
  • Re: calling a function that returns a c_char from python
    ... implicit none ... returning character array from a function ... # get longer character from fortran function ... compiler and it will itself break when the compiler gets fixed. ...
    (comp.lang.fortran)
  • Re: fortran 90/95 standart
    ... > I've a small question about fortran 90/95 standart. ... > I've a function using implicit types: ... Can you update to a newer compiler 4.0.1 is fairly in ... See the gfortran wiki to get ...
    (comp.lang.fortran)
  • Re: Ada exception block does NOT work?
    ... The parameter/formal declarations are like ... the compiler would guess for you how to call puts. ... > * implicit declaration of external functions. ... > K&R probably where good assember programmers but they where lousy compiler ...
    (comp.lang.ada)
  • Re: trim(string) problems
    ... >> Together these make me think it is a compiler problem ... >> but correctly finds size with both explicit and implicit ... that makes my test program with the module work and should ...
    (comp.lang.fortran)