This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: fortran/4398: float c subroutine returns bad value to FORTRAN main
- To: nobody at gcc dot gnu dot org
- Subject: Re: fortran/4398: float c subroutine returns bad value to FORTRAN main
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: 26 Sep 2001 19:36:00 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
The following reply was made to PR fortran/4398; it has been noted by GNATS.
From: Toon Moene <toon@moene.indiv.nluug.nl>
To: Sabba.Hillel@verizon.net
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: fortran/4398: float c subroutine returns bad value to FORTRAN main
Date: Wed, 26 Sep 2001 21:18:42 +0200
Sabba.Hillel@verizon.net wrote:
> Solaris 5.6, 5.7, 5.8
> compiled with g77-3.0.1 and gcc-3.0.1
> used -fno-second-underscore
> When compiling a FORTRAN main program calling a C subroutine which returns a floating point value,
> the result printed from the FORTRAN main routin is incorrect.
> When compiling using Solaris Workshop 6, f77, the result is correct.
> When using double returns, the results are correct.
>
> I am unable to connect the system with the gcc to the net so I am typing in the test program
>
> test-gcc.f
>
> PROGRAM TEST_G77
>
> REAL*4 PRINT_A
> REAL*4 TEST_GCC
> REAL*4 S, V, T
> REAL*8 PRINT_DA
> REAL*8 TEST_DGCC
> REAL*8 DS, DV, DT
>
> S = TEST_GCC(T)
> WRITE (*, '(A, F16.5, 3X, Z16)') "S = ", S, S
> WRITE (*, '(A, F16.5, 3X, Z16)') "T = ", T, T
> V = PRINT_A(S)
> V = PRINT_A(T)
>
> DS = TEST_DGCC(DT)
> WRITE (*, '(A, F16.5, 3X, Z16)') "DS = ", DS, DS
> WRITE (*, '(A, F16.5, 3X, Z16)') "DT = ", DT, DT
> DV = PRINT_A(DS)
> DV = PRINT_A(DT)
> END
Hmmm, exactly which values turn up wrong ? You might want to study the
warning messages g77 issues:
testf.f: In program `test_g77':
testf.f:13: warning:
V = PRINT_A(S)
1
testf.f:19: (continued):
DV = PRINT_A(DS)
2
Argument #1 of `print_a' is one precision at (2) but is some other
precision at (1) [info -f g77 M GLOBALS]
testf.f:13: warning:
V = PRINT_A(S)
1
testf.f:20: (continued):
DV = PRINT_A(DT)
2
Argument #1 of `print_a' is one precision at (2) but is some other
precision at (1) [info -f g77 M GLOBALS]
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)