Problem with GCC 4.2 and above
Lorenzo Pesce
lpesce@uchicago.edu
Sat Mar 22 02:42:00 GMT 2008
Dear all,
I have a strange problem with gcc-4.2 and above on Linux (I
compile the same code on OS X 10.4 with gcc-4.3 and it does
not create e any problems.
I I use a simple code like this one, in the file camel.f90:
---------------------------------
subroutine camel
write(8,"(I2, ' camel')") 1
end subroutine camel
----------------------------------
and I build it as a dynamically linked library with the
command (as is usually done, as far as I know):
gcc -shared -fPIC -o libcamel.so cammel.f90
I obtain the library libcamel.so.
If I load the library in "R" [>dyn.load("libcamel.so")]and
try to call it as .C("camel_" it will crash in misery. As far
as I know note that gcc makes functions as if they were c
functions, but I can call it as .Fortran("camel"), it will
crash just the same.
However, if I change the function to (that is I do not use
formatted output in fortran 90).
---------------------------------
subroutine camel
write(8, *) ' cammello', 1
end subroutine camel
----------------------------------
All works fine...
What am I doing wrong?
The same code compiles fine with gcc-4.1.1 on all systems
(sort of and so far). 4.2 breaks down on every non-OSX system
I have tried and in exactly the same way. It doesn't seem to
matter exactly which version they all break from 4.2 to 4.4.
Also the optimization seems to be dysfunctional (on some
architectures, like the AMD 64).
Thanks!
Lorenzo
More information about the Gcc-help
mailing list