public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "harald dot vogt at desy dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug translation/15397] New: c float function called from fortran gives wrong result Date: Thu, 13 May 2004 03:04:00 -0000 [thread overview] Message-ID: <20040512145606.15397.harald.vogt@desy.de> (raw) This bug is specific for the x86_64 architecture. On 32 bit architectures it does not occur. [lx64 16:27] ~/test/cernlib/x86_64 > gcc -v -save-temps -O test1.f funct2.c -lg2c -lfrtbegin Reading specs from /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/specs Configured with: /usr/src/packages/BUILD/gcc-3.4.0/configure --prefix=/opt/products/gcc/3.4.0 --enable-shared --enable-cpp --enable-threads=posix --enable-languages=c,c++,f77,java --with-local-prefix=/opt/products/gcc/3.4.0 --with-gxx-include-dir=/opt/products/gcc/3.4.0/include/g++-3 Thread model: posix gcc version 3.4.0 /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/3.4.0/f771 test1.f -quiet -dumpbase test1.f -mtune=k8 -auxbase test1 -O -version -o test1.s GNU F77 version 3.4.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 3.4.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 as -V -Qy -o test1.o test1.s GNU assembler version 2.14.90.0.5 (x86_64-suse-linux) using BFD version 2.14.90.0.5 20030722 (SuSE Linux) /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/3.4.0/cc1 -E -quiet -v -iprefix /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/ funct2.c -mtune=k8 -O -o funct2.i ignoring nonexistent directory "/afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/../../../../x86_64-unknown-linux-gnu/include" ignoring duplicate directory "/opt/products/gcc/3.4.0/lib/gcc/x86_64-unknown-linux-gnu/3.4.0/include" ignoring nonexistent directory "/opt/products/gcc/3.4.0/lib/gcc/x86_64-unknown-linux-gnu/3.4.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/include /opt/products/gcc/3.4.0/include /usr/include End of search list. /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/3.4.0/cc1 -fpreprocessed funct2.i -quiet -dumpbase funct2.c -mtune=k8 -auxbase funct2 -O -version -o funct2.s GNU C version 3.4.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 3.4.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 as -V -Qy -o funct2.o funct2.s GNU assembler version 2.14.90.0.5 (x86_64-suse-linux) using BFD version 2.14.90.0.5 20030722 (SuSE Linux) /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/3.4.0/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/crtbegin.o -L/afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0 -L/afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc -L/opt/products/gcc/3.4.0/lib/gcc/x86_64-unknown-linux-gnu/3.4.0 -L/afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/../../../../lib64 -L/afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/../../.. -L/opt/products/gcc/3.4.0/lib/gcc/x86_64-unknown-linux-gnu/3.4.0/../../../../lib64 -L/opt/products/gcc/3.4.0/lib/gcc/x86_64-unknown-linux-gnu/3.4.0/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 test1.o funct2.o -lg2c -lfrtbegin -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /afs/ifh.de/@sys/products/gcc/3.4.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.0/crtend.o /usr/lib/../lib64/crtn.o example code test1.f: program test * * error connected with return value from c routines * implicit none * real funct1, funct2, retval integer funct3, iretval * for calling a fortran function retval = funct1 (1.1111) print *, 'in test1: retval from fortran call is ', retval retval = funct2 (1.1111) print *, 'in test1: retval from c(float) call is ', retval iretval = funct3 (2) print *, 'in test1: retval from c(int) call is ', iretval stop end real function funct1 ( inval ) implicit none real inval, retval retval = inval print *, 'funct1: return value = ', retval funct1 = retval end funct2.c: float funct2_( float* value ) { float retval = *value ; printf ("funct2: return value = %f\n", retval); return retval ; } int funct3_( int* value ) { int retval = *value ; printf ("funct2: return value = %d\n", retval); return retval ; } Job output: [lx64 16:45] ~/test/cernlib/x86_64 > ./a.out funct1: return value = 1.11109996 in test1: retval from fortran call is 1.11109996 funct2: return value = 1.111100 in test1: retval from c(float) call is 0. funct2: return value = 2 in test1: retval from c(int) call is 2 -- Summary: c float function called from fortran gives wrong result Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: critical Priority: P1 Component: translation AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: harald dot vogt at desy dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: x86_64 GNU/Linux GCC host triplet: x86_64 GNU/Linux GCC target triplet: x86_64 GNU/Linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397
next reply other threads:[~2004-05-12 14:56 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-05-13 3:04 harald dot vogt at desy dot de [this message] 2004-05-13 4:39 ` [Bug fortran/15397] " bangerth at dealii dot org 2004-05-13 10:53 ` pinskia at gcc dot gnu dot org 2004-05-30 16:23 ` [Bug fortran/15397] [g77] " toon at moene dot indiv dot nluug dot nl 2004-06-03 23:37 ` [Bug target/15397] " pinskia at gcc dot gnu dot org 2004-09-18 0:10 ` pinskia at gcc dot gnu dot org 2004-10-07 9:34 ` giovannibajo at libero dot it 2004-11-17 9:19 ` Thomas dot Koenig at online dot de 2004-11-23 8:54 ` harald dot vogt at desy dot de 2005-06-12 3:23 ` pinskia at gcc dot gnu dot org 2005-06-12 15:09 ` pinskia at gcc dot gnu dot org 2005-07-06 19:22 ` gnu at the-meissners dot org 2005-07-13 13:17 ` [Bug target/15397] [3.4 only] " pinskia at gcc dot gnu dot org 2005-09-08 15:34 ` harald dot vogt at desy dot de 2005-09-22 14:17 ` kmccarty at princeton dot edu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040512145606.15397.harald.vogt@desy.de \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).