public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug translation/15397] New: c float function called from fortran gives wrong result
@ 2004-05-13  3:04 harald dot vogt at desy dot de
  2004-05-13  4:39 ` [Bug fortran/15397] " bangerth at dealii dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 18+ messages in thread
From: harald dot vogt at desy dot de @ 2004-05-13  3:04 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/15397] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
@ 2004-05-13  4:39 ` bangerth at dealii dot org
  2004-05-13 10:53 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: bangerth at dealii dot org @ 2004-05-13  4:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|translation                 |fortran


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/15397] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
  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
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-13 10:53 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug fortran/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
  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 ` toon at moene dot indiv dot nluug dot nl
  2004-06-03 23:37 ` [Bug target/15397] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: toon at moene dot indiv dot nluug dot nl @ 2004-05-30 16:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From toon at moene dot indiv dot nluug dot nl  2004-05-29 13:36 -------
This is a g77 problem.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|c float function called from|[g77] c float function
                   |fortran gives wrong result  |called from fortran gives
                   |                            |wrong result


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (2 preceding siblings ...)
  2004-05-30 16:23 ` [Bug fortran/15397] [g77] " toon at moene dot indiv dot nluug dot nl
@ 2004-06-03 23:37 ` pinskia at gcc dot gnu dot org
  2004-09-18  0:10 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-03 23:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (3 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-18  0:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-18 00:10 -------
*** Bug 17541 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rkoenker at uiuc dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (4 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-07  9:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-07 09:34 -------
Toon, can you confirm this bug as actual on the 3.4 branch? Is this a 
regression? Can this be double-checked with gfortran on mainline?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |toon at moene dot indiv dot
                   |                            |nluug dot nl, giovannibajo
                   |                            |at libero dot it


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (5 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Thomas dot Koenig at online dot de @ 2004-11-17  9:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Thomas dot Koenig at online dot de  2004-11-17 09:18 -------
(In reply to comment #3)

I checked this with gcc-4.0-20041107 on a ia64, and the problem didn't occur:

$ gfortran -v
Reading specs from /home/zfkts/lib/gcc/ia64-unknown-linux-gnu/4.0.0/specs
Configured with: ../gcc-4.0-20041107/configure --prefix=/home/zfkts
--enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.0 20041107 (experimental)
$ gfortran -O test1.f funct2.c
funct2.c: In function 'funct2_':
funct2.c:3: warning: incompatible implicit declaration of built-in function 'printf'
funct2.c: In function 'funct3_':
funct2.c:8: warning: incompatible implicit declaration of built-in function 'printf'
$ ./a.out
 funct1: return value =    1.111100
 in test1: retval from fortran call is    1.111100
funct2: return value = 1.111100
 in test1: retval from c(float) call is    1.111100
funct2: return value = 2
 in test1: retval from c(int)   call is            2
STOP 0

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (6 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: harald dot vogt at desy dot de @ 2004-11-23  8:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From harald dot vogt at desy dot de  2004-11-23 08:53 -------
(In reply to comment #0)
> 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

(In reply to comment #4)
> (In reply to comment #3)
> 
> I checked this with gcc-4.0-20041107 on a ia64, and the problem didn't occur:
> 
> $ gfortran -v
> Reading specs from /home/zfkts/lib/gcc/ia64-unknown-linux-gnu/4.0.0/specs
> Configured with: ../gcc-4.0-20041107/configure --prefix=/home/zfkts
> --enable-languages=c,c++,f95
> Thread model: posix
> gcc version 4.0.0 20041107 (experimental)
> $ gfortran -O test1.f funct2.c
> funct2.c: In function 'funct2_':
> funct2.c:3: warning: incompatible implicit declaration of built-in function
'printf'
> funct2.c: In function 'funct3_':
> funct2.c:8: warning: incompatible implicit declaration of built-in function
'printf'
> $ ./a.out
>  funct1: return value =    1.111100
>  in test1: retval from fortran call is    1.111100
> funct2: return value = 1.111100
>  in test1: retval from c(float) call is    1.111100
> funct2: return value = 2
>  in test1: retval from c(int)   call is            2
> STOP 0

May be the following may give a hint to the g77 developers:
if using the -fno-f2c compile option the error does not occur on AMD64
architectures.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (7 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-12  3:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-12 03:23 -------
(In reply to comment #5)
> May be the following may give a hint to the g77 developers:
> if using the -fno-f2c compile option the error does not occur on AMD64
> architectures.

That means the ABI is different with those two.

I don't think this is a bug.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (8 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-12 15:09 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|x86_64 GNU/Linux            |
   GCC host triplet|x86_64 GNU/Linux            |
 GCC target triplet|x86_64 GNU/Linux            |x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (9 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: gnu at the-meissners dot org @ 2005-07-06 19:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gnu at the-meissners dot org  2005-07-06 19:22 -------
FWIW, I tried this with the 4.0 compiler on an AMD64 system, and it doesn't fail
with gfortran.

I did bring over the 3.4.4 release, and tried it with g77, and it failed as
reported.  It passed if I used -m32 with the traditional x86 calling sequence.

If I link the 3.4.4 fortran object with the 4.0.0 C object, it fails.  If I link
the 4.0.0 fortran with the 3.4.4 C object, it passes.

Looking at the code for -O1, between 3.4.4 and 4.0.0, I see, the 4.0.0 generates:
	call	funct2_
	movss	%xmm0, 12(%rsp)

and the 3.4.4 fortran generates:
	call	funct2_
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, 16(%rsp)

Ie, g77 is expecting float values to be returned as a double, and then doing the
conversion.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [3.4 only] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (10 preceding siblings ...)
  2005-07-06 19:22 ` gnu at the-meissners dot org
@ 2005-07-13 13:17 ` 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
  13 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-13 13:17 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[g77] c float function      |[3.4 only] [g77] c float
                   |called from fortran gives   |function called from fortran
                   |wrong result                |gives wrong result
   Target Milestone|---                         |3.4.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [3.4 only] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (11 preceding siblings ...)
  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
  13 siblings, 0 replies; 18+ messages in thread
From: harald dot vogt at desy dot de @ 2005-09-08 15:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From harald dot vogt at desy dot de  2005-09-08 15:34 -------
(In reply to comment #7)

gfortran has changed the default!
Looking in the gfortran manual the -fno-f2c is now the default and -ff2c will
switch back to the g77 default. Therefore gfortran gives a correct result. Can
you check the code with "gfortran -ff2c"?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [3.4 only] [g77] c float function called from fortran gives wrong result
  2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
                   ` (12 preceding siblings ...)
  2005-09-08 15:34 ` harald dot vogt at desy dot de
@ 2005-09-22 14:17 ` kmccarty at princeton dot edu
  13 siblings, 0 replies; 18+ messages in thread
From: kmccarty at princeton dot edu @ 2005-09-22 14:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kmccarty at princeton dot edu  2005-09-22 14:17 -------
Could anyone find out whether this g77 bug applies to other 64-bit Linux
architectures as well as AMD64?  I'm thinking of Alpha, Itanium, S390x, and
64-bit PowerPC and SPARC.  Thanks in advance for any such information,
especially on the first two of these.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmccarty at princeton dot
                   |                            |edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [3.4 only] [g77] c float function called from fortran gives wrong result
       [not found] <bug-15397-4@http.gcc.gnu.org/bugzilla/>
@ 2014-02-16 13:13 ` jackie.rosen at hushmail dot com
  0 siblings, 0 replies; 18+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #11 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [3.4 only] [g77] c float function called from fortran gives wrong result
       [not found] <bug-15397-8520@http.gcc.gnu.org/bugzilla/>
  2005-10-07  3:21 ` gdr at gcc dot gnu dot org
@ 2006-02-28  9:24 ` gdr at gcc dot gnu dot org
  1 sibling, 0 replies; 18+ messages in thread
From: gdr at gcc dot gnu dot org @ 2006-02-28  9:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from gdr at gcc dot gnu dot org  2006-02-28 09:23 -------
won't fix for 3.4.6.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Bug target/15397] [3.4 only] [g77] c float function called from fortran gives wrong result
       [not found] <bug-15397-8520@http.gcc.gnu.org/bugzilla/>
@ 2005-10-07  3:21 ` gdr at gcc dot gnu dot org
  2006-02-28  9:24 ` gdr at gcc dot gnu dot org
  1 sibling, 0 replies; 18+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-10-07  3:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.5                       |3.4.6


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15397


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-02-16 13:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13  3:04 [Bug translation/15397] New: c float function called from fortran gives wrong result harald dot vogt at desy dot de
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
     [not found] <bug-15397-8520@http.gcc.gnu.org/bugzilla/>
2005-10-07  3:21 ` gdr at gcc dot gnu dot org
2006-02-28  9:24 ` gdr at gcc dot gnu dot org
     [not found] <bug-15397-4@http.gcc.gnu.org/bugzilla/>
2014-02-16 13:13 ` jackie.rosen at hushmail dot com

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).