Opened 12 years ago
Closed 12 years ago
#36229 closed defect (invalid)
gfortran return values of type real(kind=8) or real(kind-10) are mangled
Reported by: | Polyergic (Shad Sterling) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.1.2 |
Keywords: | gfortran | Cc: | mww@… |
Port: | gcc45 |
Description
The output should be one number twice and a second number twice. With kind=8 or kind=10, passing a value into the function works (the first number is repeated correctly), but returning a value out of the function does not (the second number is not repeated correctly).
output with kind=4:
1.2345679 1.2345679 0.34567890 0.34567890
output with kind=8:
1.2345678806304932 1.2345678806304932 0.34567889571189880 3.68934881474191032E+019
output with kind=10:
1.2345678806304931641 1.2345678806304931641 0.34567889571189880371 -3.74416264051907754506E-0013
code with kind=10:
program bugtest real(kind=10) :: test = 1.234567890123456789012345678901 print *, test test = check(test) print *, test end program bugtest function check(x) real(kind=10) :: x, check check = 0.345678901234567890123456789012 print *, x print *, check end
environment:
$ system_profiler SPSoftwareDataType Software: System Software Overview: System Version: Mac OS X 10.7.4 (11E53) Kernel Version: Darwin 11.4.0 Boot Volume: Macintosh HD Boot Mode: Normal Computer Name: Shad Sterling’s MacBook User Name: Shad Sterling (polyergic) Secure Virtual Memory: Enabled 64-bit Kernel and Extensions: No Time since boot: 5 days 13:13 $ port version Version: 2.1.2 $ which gfortran /opt/local/bin/gfortran [2012-Sep-19-Wed 19:33:59] polyergic@laconic : ~/Documents/2012/MATH 4610 - Numerical Analysis 1/Homework 2 $ ls -l `which gfortran` lrwxr-xr-x 1 root admin 30 Sep 19 12:05 /opt/local/bin/gfortran -> /opt/local/bin/gfortran-mp-4.5 [2012-Sep-19-Wed 19:34:18] polyergic@laconic : ~/Documents/2012/MATH 4610 - Numerical Analysis 1/Homework 2 $ gfortran --version GNU Fortran (MacPorts gcc45 4.5.4_4) 4.5.4 Copyright (C) 2010 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING
(I don't understand the "64-bit Kernel and Extensions: No"; Activity Monitor shows mostly 64-bit processes, including every instance of bash.)
Change History (3)
comment:1 Changed 12 years ago by Polyergic (Shad Sterling)
comment:2 Changed 12 years ago by Polyergic (Shad Sterling)
Apparently I was missing an "IMPLICIT NONE" and type declarations for called functions at the top of every program/function/subroutine. If I ever write about Fortran I'll include that anywhere I describe types or calls (unlike any examples or tutorials I've seen). So this should be closed as invalid (I don't see a way to do that myself).
comment:3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | mww@… added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
I'm also getting a similar error with integers. I'm new to fortran, so maybe I'm missing something, but I haven't found anything that explains this.
output with integer:
code with integer: