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]

Strange Fortran/C/Java interaction


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

Attachment: testcase.tgz
Description: Binary data


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