Bug 20236 - runtime error reading float
Summary: runtime error reading float
Status: RESOLVED DUPLICATE of bug 16436
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 20235 (view as bug list)
Depends on:
Blocks: 20235
  Show dependency treegraph
 
Reported: 2005-02-27 17:19 UTC by Emil Block
Modified: 2005-06-01 09:44 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-03-23 22:58:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emil Block 2005-02-27 17:19:48 UTC
/sodsim/local/gcc-4.0-20050220#>gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.8
Configured with: ../configure --enable-languages=c,f95
Thread model: posix
gcc version 4.0.0 20050220 (experimental)
Build with no problems.
This little test program was created as a result of a runtime error on
a large program used to test gfortran. G77 does not have this problem.   
************************************************************************
      program ntst

      character*16 bufld
      character*142 line
      
      open (10,file='bumsls',status='old')
     
 32   read (10,'(a)',end=33) line
      if (line(1:1) .eq. '.') goto 32

      write(*,*) 'write values on the line ',line
      write(*,*)

      read (line,79) bufld,budelt
 79   format (t43,a16,t61,f8.0)

      write(*,*) 'write 2 values from the line ',bufld,budelt
      write(*,*)
      
 33   continue
       
      end
************************************************************************
At line 14 of file ntst.f
Fortran runtime error: Bad value during floating point read

bumsls file contents 3 lines
*****************************************************************************
.
. ----  ------  ---  --------- ---------  ----------------  --------  ----  -----
     1  axxxx     1    54.3000   35.3000  rrrabcrbbbbxxxxb     1200.  13p3  33333
Comment 1 Tobias Schlüter 2005-02-27 18:34:26 UTC
*** Bug 20235 has been marked as a duplicate of this bug. ***
Comment 2 Tobias Schlüter 2005-02-27 18:41:11 UTC
Fixed form testcase which doesn't need the data file:
      program ntst

      character*16 bufld
      character*142 line

      line = '     1  axxxx     1    54.3000   35.3000  rrrabcrbbbbxxxx'
     1     //'b     1200.  13p3  33333'

      write(*,*) 'write values on the line ',line
      write(*,*)

      read (line,79) bufld,budelt
 79   format (t43,a16,t61,f8.0)

      write(*,*) 'write 2 values from the line ',bufld,budelt
      write(*,*)
      
 33   continue
       
      end

Works with g77, output:
 write values on the line
      1  axxxx     1    54.3000   35.3000  rrrabcrbbbbxxxxb     1200.  13p3  33333

 write 2 values from the line rrrabcrbbbbxxxxb  1200.

Runtime error with gfortran.
Comment 3 Francois-Xavier Coudert 2005-03-23 22:58:21 UTC
Using testcase from comment #2, I don't get a runtime error but the program
hangs out forever:

Program received signal SIGINT, Interrupt.
0x0806b971 in memset ()
Current language:  auto; currently asm
(gdb) where
#0  0x0806b971 in memset ()
#1  0x08048ba1 in *_gfortrani_read_block (length=0xbffff7a4)
    at ../../../gcc/libgfortran/io/transfer.c:153
#2  0x080529b8 in *_gfortrani_read_x (f=0x0)
    at ../../../gcc/libgfortran/io/read.c:726
#3  0x08049b72 in formatted_transfer (type=BT_CHARACTER, p=0xbffff8e4, len=16)
    at ../../../gcc/libgfortran/io/transfer.c:684
#4  0x08048f77 in *_gfortran_transfer_character (p=0xbffff8d4, len=16)
    at ../../../gcc/libgfortran/io/transfer.c:820
#5  0x080482e9 in MAIN__ ()
#6  0x080483b8 in main (argc=1, argv=0xbffffb54)
    at ../../../gcc/libgfortran/fmain.c:18


This behavior is, I think, due to the T edit descriptor. From what I have seen,
T and TL descriptors are incorrectly handled in library (see PR16436).
Comment 4 Francois-Xavier Coudert 2005-06-01 09:44:32 UTC
As I suggested in comment #3, this is a duplicate of PR16436. Patch from
http://gcc.gnu.org/ml/fortran/2005-05/msg00439.html fixes both.

*** This bug has been marked as a duplicate of 16436 ***