This is the mail archive of the gcc@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]

Re: option -warn-common for Fortran?


Quoting craig@jcb-sc.com (craig@jcb-sc.com):
> >wouldn't it make sense to leave out -warn-common from the linker options
> >on Linux (collect2), if we link with g77?
> >
> >These 'errors' are quite useful in Fortran 77.
> >(Common blocks have to be defined in every subroutine, where they are used.
> >So you have them muliply defined in every source file.)
> >
> >(i get a lot of output linking my progs here...)
> 
> Anything you want to share with us, by way of a small example?  AFAIK,
> g77 doesn't output a *definition* for a common block unless it is asked
> to *initialize* it with at least one value (via DATA, for example).

> If you're initializing a given common block in more than one program unit,
> you're violating the FORTRAN 77 standard.  (In fact, you're doing that
> if you initialize it in anything other than a BLOCK DATA program unit,
> but g77 relaxes that particular rule.)
> 
> But if you can show an example where simply *declaring* (in C terms)
> a common block in multiple program units (perhaps in different source
> files) leads to warnings, then, yes, I'd say those warnings represent
> bugs, and it'd be nice to find out why they (presumably) don't happen
> when equivalent C code (such as output by f2c) is compiled and linked.

I tested it with this:
foo1.f:
      SUBROUTINE FOO1
      INTEGER I
      COMMON /BAR/ I
      RETURN
      END

      CALL FOO1
      CALL FOO2
      END

foo2.f
      SUBROUTINE FOO2
      INTEGER I
      COMMON /BAR/ I
      RETURN
      END
g77 -c foo2.f
g77 -o foo foo1.o foo2.o

and got the warnings.
BUT: this works on linux-2.0.37! I get these errors only on > 2.2.5

Seems to have nothing to do with egcs, but with the kernel - see the
other strange things, which happen to me on 2.2.10...
It seems, that if i compile the same file twice (a hello world F77 prog)
i get different results (the hexdump has an additional 0 byte inside)
But that's all only on linux > 2.2.5.

Perhaps that's all a nfs problem?

Sorry for the noise.
Thank you!


-- 
esa$ gcc -Wall -o ariane5 ariane5.c
ariane5.c: 666: warning: long float implicitly truncated to unsigned type
esa$ ariane5


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