[Bug fortran/61847] bug in gfortran runtime on OSX: digits cut off when reading floating point number

2014-07-21 Thread e2cd58e1 at opayq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

--- Comment #3 from e2cd58e1 at opayq dot com ---
but what I want to do is read in values with point as decimal separator. Using

  open(unit=1,file='bug.dat', decimal=point)

doesn't seem to change anything.


[Bug fortran/61847] bug in gfortran runtime on OSX: digits cut off when reading floating point number

2014-07-21 Thread e2cd58e1 at opayq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

--- Comment #5 from e2cd58e1 at opayq dot com ---
I actually don't know - how can I test this?

But either way, shouldn't 

open(unit=1,file='bug.dat', decimal=point)

read 1.234 in as 1.234 no matter what the locale settings are?


[Bug fortran/61847] bug in gfortran runtime on OSX: digits cut off when reading floating point number

2014-07-21 Thread e2cd58e1 at opayq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

--- Comment #7 from e2cd58e1 at opayq dot com ---
For

printf(Test 1 = %.4f\n,strtod(1.2345,NULL));
printf(Test 2 = %.4f\n,strtod(1,2345,NULL));

I get

Test 1 = 1,
Test 2 = 1,2345


[Bug fortran/61847] bug in gfortran runtime on OSX: digits cut off when reading floating point number

2014-07-21 Thread e2cd58e1 at opayq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

--- Comment #9 from e2cd58e1 at opayq dot com ---
Just what I get:

1.2345 = 1.2345 and 5,4321 = 5.
1.2345 = 1, and 5,4321 = 5,4321


[Bug fortran/61847] bug in gfortran runtime: digits cut off when reading floating point number

2014-07-21 Thread e2cd58e1 at opayq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61847

--- Comment #12 from e2cd58e1 at opayq dot com ---
Sorry but I still have a problem with this, maybe I didn't get what you are
saying or I wasn't clear enough.  

Suppose I cannot change the C-wrapper and the locale might be set to whatever.
The file bug.dat already exists and uses point decimals. So I want a fortran
routine that always reads in a file in the usual point separated format. 

If in the fortran routine I call

open(unit=1,file='bug.dat', decimal=point)

I expect the keyword to be more important than the locale setting: I explicitly
specify to read point separated values, but in the example below, it still
returns 1.0 instead of 1.2345. Is that really expected behavior?

- bug.c --
#include stdlib.h /* strtod */
#include locale.h  
#include stdio.h  

int badcall_();  
int main() 
{  
setlocale(LC_ALL, de_DE.UTF-8);  
badcall_();  
return 0;  
}
- bug.dat --
1.2345
- bugf.f90 --
subroutine badcall()  
  implicit none  
  double precision :: res
  open(unit=1,file='bug.dat',decimal=point)  
  read(1,*) res
  write(*,*) 'res =', res
end subroutine badcall


[Bug fortran/61847] New: bug in gfortran runtime on OSX: digits cut off when reading floating point number

2014-07-18 Thread e2cd58e1 at opayq dot com
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=33154action=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. 

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