FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

 
 
LinkBack Thread Tools
 
Old 02-01-2012, 11:13 AM
SAITO Fuyuki
 
Default Bug#658251: gfortran-4.6: Minimum integer cannot be parsed by read statement

Package: gfortran-4.6
Version: 4.6.2-12
Severity: normal

Dear Maintainer,

Formatted read statement cannot parse the minimum integer by a program
compiled by gfortran-4.6.

I compiled the following test program with no options,
----------------------------------------
program test_int_min
implicit none
integer :: i
integer :: ios
read (*, *, IOSTAT=ios) i
if (ios.ne.0) then
write (*, *) 'ERROR', ios
endif
write (*, *) i, -i, -i-1, -i-2
stop
end program test_int_min
----------------------------------------

and executes as follows.

----------------------------------------
% gfortran test_int_min.f
% echo 2147483647 | ./a.out
2147483647 -2147483647 -2147483648 2147483647
% echo -2147483647 | ./a.out
-2147483647 2147483647 2147483646 2147483645
% echo -2147483648 | ./a.out
ERROR 5010
0 0 -1 -2
----------------------------------------

You see we can compute, store, write the actual minimum integer
-2147483648 in the program, but fail to read it.
Similar error occurs also when using a namelist.

I suspect that gfortran converts a string of a number to the absolute
value before sign treatment, which causes overflow of integer.

Best regards,

-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-1-686-pae (SMP w/4 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gfortran-4.6 depends on:
ii gcc-4.6 4.6.2-12
ii gcc-4.6-base 4.6.2-12
ii libc6 2.13-25
ii libc6-dev 2.13-25
ii libgfortran3 4.6.2-12
ii libgmp10 2:5.0.3+dfsg-1
ii libmpc2 0.9-4
ii libmpfr4 3.1.0-3
ii zlib1g 1:1.2.3.4.dfsg-3

gfortran-4.6 recommends no packages.

Versions of packages gfortran-4.6 suggests:
ii gfortran-4.6-doc <none>
ii gfortran-4.6-multilib 4.6.2-12
ii libgfortran3-dbg 4.6.2-12

-- no debconf information



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: i8upqdylpjp.wl%fuyuki@poem.ocn.ne.jp">http://lists.debian.org/i8upqdylpjp.wl%fuyuki@poem.ocn.ne.jp
 
Old 02-29-2012, 07:03 AM
Tobias Burnus
 
Default Bug#658251: gfortran-4.6: Minimum integer cannot be parsed by read statement

> Formatted read statement cannot parse the minimum integer by a program
> compiled by gfortran-4.6.

I think the line of thought is that the number -2147483648 == -huge(0)-1
is not a valid integer number as it is outside of Fortran's numerical
model, which assumes that the smallest and the largest number only differ
by the sign. See "13.4 Numeric models", paragraph 2 of the Fortran 2008
standard [1]. (While the most common binary integer representation in
hardware allows for integers ranging from -huge(0)-1 to huge(0).)

With the same argument, gfortran also rejects such integer literals
in the source code. However, there the flag -fno-range-check can be used
to still accept the value.

For I/O, I concur that being able to write such a number but not being
able to read it back it, is unexpected and should be fixed.

I filled an upstream problem report (PR) at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52428


[1] Final Draft International Standard (FDIS) of Fortran 2008
(ISO/IEC 1539-1:2010):
ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1830.pdf



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120229080309.GA1981@physik.fu-berlin.de">http://lists.debian.org/20120229080309.GA1981@physik.fu-berlin.de
 

Thread Tools




All times are GMT. The time now is 06:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org