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]
Other format: [Raw text]

Problem with gfortran or did I messsed up GMP installation?


I've just recompiled GCC 4.0.2 for sparc-sun-solaris2.9 with fortran language enabled. To test it, I found short hello world program on the net (included).

If I produce 32-bit binary by simply using "gfortran hello.f", it compiles, but the resulting binary exits immediatelly (no output). If I produce 64-bit binary using "gfortran -m64 hello.f", the program prints hello world in an infinite loop. Hmph...

The only "unusual" thing on my system was small manual fix to have both 32-bit and 64-bit GMP installed with same prefix. The fix was to compare gmp.h file from 32-bit and 64-bit build and merge them (so that I can use same gmp.h file for compiling both 32-bit and 64-bit programs) by changing lines that define __GMP_BITS_PER_MP_LIMB and GMP_LIMB_BITS like this:

#ifdef  _LP64
#define __GMP_BITS_PER_MP_LIMB             64
#else   /* _ILP32 */
#define __GMP_BITS_PER_MP_LIMB             32
#endif

#ifdef  _LP64
#define GMP_LIMB_BITS                      64
#else   /* _ILP32 */
#define GMP_LIMB_BITS                      32
#endif

This looked like the correct way to go. The same ifdef construct is used throughout system include files (/usr/include) for the same purpose.

Of course, 32-bit and 64-bit libgmp and libmpfr libraries live each in its own directory (32-bit in /prefix/lib, 64-bit in /prefix/lib/sparcv9).

So, the question is, did I broke something by attempting to have both 32-bit and 64-bit GMP library installed simultaniously? Did I miss anything needed to have both 32-bit and 64-bit GMP available on the system? Or is there something wrong with gfortran compiler?

The "hello world" program looks like this. I haven't done anything fortran in a veeeeeeeery long time (last time like in 1992 or something). Looks to me like it should just print hello world in endless loop.

c
c   Hello, world.
c
     Program Hello

     implicit none
     logical DONE

     DO while (.NOT. DONE)
       write(*,10)
     END DO
  10 format('Hello, world.')
     END


---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.



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