https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

            Bug ID: 61847
           Summary: bug in gfortran runtime on OSX: digits cut off when
                    reading floating point number
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: e2cd58e1 at opayq dot com

Created attachment 33154
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33154&action=edit
source code

Reading a floating point number from a file cuts off digits, depending on the C
locale.

This happens on a Mac when the locale is set to de_DE UTF-8 (note: in german,
the comma is used as separator for digits, but gfortran probably shouldn't do
that). gcc is installed from homebrew, Mac OS X 10.9.4

Attached example was build & executed with

    gfortran -v -save-temps -Wall -Wextra -o bug bugf.f90 bug.c && ./bug

It returns:

     FAIL   1.0000000000000000 

But shouldn't return something.

----------------------------
gcc -v
----------------------------

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

----------------------------
gfortran -v
----------------------------

Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/lto-wrapper
Target: x86_64-apple-darwin13.2.0
Configured with: ../configure --build=x86_64-apple-darwin13.2.0
--prefix=/usr/local/Cellar/gcc/4.8.3_1
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-4.8
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog
--with-isl=/usr/local/opt/isl --with-system-zlib
--enable-version-specific-runtime-libs --enable-libstdcxx-time=yes
--enable-stage1-checking --enable-checking=release --enable-lto
--disable-werror --with-pkgversion='Homebrew gcc 4.8.3_1'
--with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin
--disable-nls --enable-multilib
Thread model: posix
gcc version 4.8.3 (Homebrew gcc 4.8.3_1) 

------------------------------
compilation output for
gfortran -v -save-temps -Wall -Wextra -o bug bugf.f90 bug.c
------------------------------

Driving: gfortran -mmacosx-version-min=10.9.3 -v -save-temps -Wall -Wextra -o
bug bugf.f90 bug.c -l gfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/lto-wrapper
Target: x86_64-apple-darwin13.2.0
Configured with: ../configure --build=x86_64-apple-darwin13.2.0
--prefix=/usr/local/Cellar/gcc/4.8.3_1
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-4.8
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog
--with-isl=/usr/local/opt/isl --with-system-zlib
--enable-version-specific-runtime-libs --enable-libstdcxx-time=yes
--enable-stage1-checking --enable-checking=release --enable-lto
--disable-werror --with-pkgversion='Homebrew gcc 4.8.3_1'
--with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin
--disable-nls --enable-multilib
Thread model: posix
gcc version 4.8.3 (Homebrew gcc 4.8.3_1) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'
 /usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/f951
bugf.f90 -fPIC -quiet -dumpbase bugf.f90 -mmacosx-version-min=10.9.3
-mtune=core2 -auxbase bugf -Wall -Wextra -version -fintrinsic-modules-path
/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/finclude
-o bugf.s
GNU Fortran (Homebrew gcc 4.8.3_1) version 4.8.3 (x86_64-apple-darwin13.2.0)
    compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2-p8,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (Homebrew gcc 4.8.3_1) version 4.8.3 (x86_64-apple-darwin13.2.0)
    compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2-p8,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
bugf.f90:6.6:

  if (res.ne.1.2345d0) write(*,*) 'FAIL', res
      1
Warning: Inequality comparison for REAL(8) at (1)
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'
 as -arch x86_64 -force_cpusubtype_ALL -o bugf.o bugf.s
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'
 /usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/cc1
-E -quiet -v -D__DYNAMIC__ bug.c -fPIC -mmacosx-version-min=10.9.3 -mtune=core2
-Wall -Wextra -fpch-preprocess -o bug.i
ignoring nonexistent directory "/usr/local/Cellar/gcc/4.8.3_1/include"
ignoring nonexistent directory
"/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/../../../../x86_64-apple-darwin13.2.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/include
 /usr/local/include

/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'
 /usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/cc1
-fpreprocessed bug.i -fPIC -quiet -dumpbase bug.c -mmacosx-version-min=10.9.3
-mtune=core2 -auxbase bug -Wall -Wextra -version -o bug.s
GNU C (Homebrew gcc 4.8.3_1) version 4.8.3 (x86_64-apple-darwin13.2.0)
    compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2-p8,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (Homebrew gcc 4.8.3_1) version 4.8.3 (x86_64-apple-darwin13.2.0)
    compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2-p8,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: eb08082bfa130f9363d9c840483f8fa0
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'
 as -arch x86_64 -force_cpusubtype_ALL -o bug.o bug.s
Reading specs from
/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'
COMPILER_PATH=/usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/:/usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/:/usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/:/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/:/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/
LIBRARY_PATH=/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/:/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.9.3' '-v' '-save-temps' '-Wall'
'-Wextra' '-o' 'bug' '-shared-libgcc' '-mtune=core2'

/usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/collect2
-dynamic -arch x86_64 -macosx_version_min 10.9.3 -weak_reference_mismatches
non-weak -o bug
-L/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3
-L/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/../../..
bugf.o bug.o -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc
-lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v
collect2 version 4.8.3
/usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.9.3
-weak_reference_mismatches non-weak -o bug
-L/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3
-L/usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/../../..
bugf.o bug.o -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc
-lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v
@(#)PROGRAM:ld  PROJECT:ld64-236.4
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 armv6m armv7m
armv7em
Library search paths:
    /usr/local/Cellar/gcc/4.8.3_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3
    /usr/local/Cellar/gcc/4.8.3_1/lib
    /usr/lib
    /usr/local/lib
Framework search paths:
    /Library/Frameworks/
    /System/Library/Frameworks/

Reply via email to