This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: fortran and c pointers in gcc 2.95.2
- To: "Maciej Z. Pindera" <mzp at HiWAAY dot net>
- Subject: Re: fortran and c pointers in gcc 2.95.2
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Sun, 10 Sep 2000 20:39:15 +0200
- CC: gcc at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <39BB49BA.F69DB441@HiWAAY.net>
Maciej Z. Pindera wrote:
>
> I recently built gcc 2.95.2 on a DEC Alpha box running OSF v4.(d?). I
> compiled and linked some code consisting of Fortran and C routines, the
> latter mainly used for dynamic memory allocation.
>
> Unfortunately, the code bombs during execution time (apparently) due to
> the compiler's truncation of fortran pointer sizes, resulting in pointer
> mismatch (4 bits for fortran and 8 bits for C). I am aware that this
> problem had existed in earlier versions of gcc; version 2.92.2 was not
> supposed to do that. Is there some switch that needs to be set in order
> to prevent this behavior?
Hmm, without showing us any source code, this will be hard to solve.
Firstly, Fortran (at least the language compiled by g77) doesn't know of
the concept of "pointers", so it is hard to deduce (without source code)
what you mean by "a mismatch (4 bits for fortran and 8 bits for C)
[pointers] (you probably mean "bytes", here - not "bits").
Secondly, if you try to fool g77 into accepting a pointer returned by a
C routine as an INTEGER, you're in deep trouble, because the pointer
will be 8 bytes on the Alpha (and the 64 bit Sparc, and the 64 bit
PowerPC, and the (always upcoming) Itanium, etc.) but the INTEGER will
be 4 bytes.
Please show us some source - we showed ours to you :-)
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)