public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: fortran/4398: float c subroutine returns bad value to FORTRAN main
@ 2001-10-29 23:38 toon
  0 siblings, 0 replies; 4+ messages in thread
From: toon @ 2001-10-29 23:38 UTC (permalink / raw)
  To: Sabba.Hillel, gcc-bugs, gcc-prs, toon

Synopsis: float c subroutine returns bad value to FORTRAN main

State-Changed-From-To: feedback->closed
State-Changed-By: toon
State-Changed-When: Mon Oct 29 23:38:28 2001
State-Changed-Why:
    Feedback convinced me to reopen this as a target/SPARC
    Problem Report, number 4731.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4398&database=gcc


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

* Re: fortran/4398: float c subroutine returns bad value to FORTRAN main
@ 2001-09-27  0:53 toon
  0 siblings, 0 replies; 4+ messages in thread
From: toon @ 2001-09-27  0:53 UTC (permalink / raw)
  To: Sabba.Hillel, gcc-bugs, gcc-prs, nobody, toon

Synopsis: float c subroutine returns bad value to FORTRAN main

Responsible-Changed-From-To: unassigned->toon
Responsible-Changed-By: toon
Responsible-Changed-When: Thu Sep 27 00:53:13 2001
Responsible-Changed-Why:
    My job
State-Changed-From-To: open->feedback
State-Changed-By: toon
State-Changed-When: Thu Sep 27 00:53:13 2001
State-Changed-Why:
    Feedback requested on warning messages and exact description
    of wrong output.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4398&database=gcc


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

* Re: fortran/4398: float c subroutine returns bad value to FORTRAN main
@ 2001-09-26 12:36 Toon Moene
  0 siblings, 0 replies; 4+ messages in thread
From: Toon Moene @ 2001-09-26 12:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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)


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

* fortran/4398: float c subroutine returns bad value to FORTRAN main
@ 2001-09-25 15:46 Sabba.Hillel
  0 siblings, 0 replies; 4+ messages in thread
From: Sabba.Hillel @ 2001-09-25 15:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4398
>Category:       fortran
>Synopsis:       float c subroutine returns bad value to FORTRAN main
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 25 15:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Sabba.Hillel@verizon.net
>Release:        gcc-3.0.1 g77-3.0.1
>Organization:
>Environment:
Solaris 5.6, 5.7, 5.8
compiled with g77-3.0.1 and gcc-3.0.1

used -fno-second-underscore
>Description:
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



C language functions test-gcc.c


float test_gcc_(float *b)
{
  float a;

  *b = 10.0;
  a = *b;
  printf("a=%f (%#x)\n", a, a);
  printf("b=%f (%#x)\n", b, b);
  return(a);
}

float print_a_(float *a)
{
  printf("A = %f (%#x)\n", *a, *a);
  return (0);
}

double test_dgcc_(double *db)
{
  double da;

  *db = 10.0;
  da = *db;
  printf("da=%f (%#x)\n", da, da);
  printf("db=%f (%#x)\n", db, db);
  return(da);
}

double print_da_(float *da)
{
  printf("DA = %f (%#x)\n", *da, *da);
  return (0);
}


-- 
Said the fox to the fish, "Join me ashore."
The fish are the Jews, Torah is our water.

Hillel (Sabba) Markowitz - sabbahem@bcpl.net
>How-To-Repeat:
See test program in description
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2001-10-29 23:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-29 23:38 fortran/4398: float c subroutine returns bad value to FORTRAN main toon
  -- strict thread matches above, loose matches on Subject: below --
2001-09-27  0:53 toon
2001-09-26 12:36 Toon Moene
2001-09-25 15:46 Sabba.Hillel

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