Strange Fortran/C/Java interaction
Martin Reinecke
martin@MPA-Garching.MPG.DE
Thu Jul 4 09:22:00 GMT 2013
Hi,
I'm not sure if this is a bug in gcc, or in Java,
or maybe even a feature, so I'm asking for opinion here before
opening a PR...
The attached testcase requires gcc and gfortran, as well as a JDK
installation. When running "make" with gcc/gfortran 4.7.2 and
Oracle JDK 1.7, a single call to JNI_CreateJavaVM() changes the
behaviour of subsequent READ statements in the Fortran code,
depending on the value of the LC_ALL environment variable.
If this is a bug (it certainly feels like one to me), do you think
it is fixable in either gcc or the Java libraries, or is this
some unfortunate interaction that cannot really be fixed?
If there is something that can be done in gcc, I'll be happy to open
a full bug report.
Cheers,
Martin
Output of "make" on my local machine for reference:
rm -f *.o testcase *~
gcc -I/opt/java/jdk7/include -I/opt/java/jdk7/include/linux -c testcase_c.c
gfortran -c testcase_f.f90
gfortran -o testcase testcase_c.o testcase_f.f90
-L/opt/java/jdk7/jre/lib/amd64/server -ljvm
running with LC_ALL=C
before JVM creation: result= 2.7260000000000000
after JVM creation: result= 2.7260000000000000
running with LC_ALL=POSIX
before JVM creation: result= 2.7260000000000000
after JVM creation: result= 2.7260000000000000
running with LC_ALL=de_DE
before JVM creation: result= 2.7260000000000000
after JVM creation: result= 2.0000000000000000
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.tgz
Type: application/octet-stream
Size: 910 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20130704/aa7fe91d/attachment.obj>
More information about the Gcc
mailing list