Two of Eef's bugs, was: Re: gfortran

Bud Davis bdavis9659@sbcglobal.net
Sat Dec 23 16:45:00 GMT 2006


--- Tobias Schlüter
<tobias.schlueter@physik.uni-muenchen.de> wrote:

> Thomas Koenig <Thomas.Koenig@online.de> wrote on
> Fri, 22 Dec 2006:
> > On Fri, Dec 22, 2006 at 09:20:12AM -0800, Steve
> Kargl wrote:
> >
> >>    "Integer output constants are produced with
> the effect of
> >>     an Iw edit descriptor."
> >>     ...
> >>    "For numeric output, reasonable
> processor-dependent values
> >>     of w, d, and e are used for each of the
> numeric constants
> >>     output."
> >
> > In this case, we could make the default format for
> list-directed
> > output of integers '(" ",I0)'.
> >
> >>
> >> For portable code, Eef needs to determine the
> processor-dependent
> >> value for w.
> >
> > I don't think w has to be the same value for all
> constants.  It
> > would probably be best to use a format that cannot
> overflow
> > the substring, such as
> >
> >     write (unit=c(1:5),fmt='(I5)') i
> 
> In fact, by the excerpts you posted from the
> standard, there are no  
> guarantees that list-directed output to internal
> units could ever  
> work, as the processor-chosen value for w could
> always exceed the  
> length of the internal unit.  That said, g77 does
> something rather  
> weird here: I had expected it to do the same as with
> formatted output:  
> if there's not enough space, print asterisks '*',
> but it simply  
> truncates the string:
> schluter@pcl247d:~/src> cat internal.f
>          character*20 c
>          integer i
>          c = ""
>          i = 1
>          do j=1,5
>             c = "12345678901234567890"
>             write (c(1:5),*) i
>             print *, c
>             i=i*100
>          end do
>          end
> 
> schluter@pcl247d:~/src> g77 internal.f
> schluter@pcl247d:~/src> ./a.out
>    1   678901234567890
>    100 678901234567890
>    1000678901234567890
>    1000678901234567890
>    1000678901234567890
> schluter@pcl247d:~/src>
> 
> I don't think we should imitate g77 here, but as
> we've seen, no matter  
> how we deviate from g77, someone will get bitten by
> it, and complain :-/
> 
> Cheers,
> - Tobi
> 
>
----------------------------------------------------------------
> This message was sent using IMP, the Internet
> Messaging Program.
>

we had a very similar bug in g77/f2c a couple of years
ago:
 
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1832

if i remember correctly, list directed I/O was not
required to work as part of F77; thus the truncation
was deemed acceptable when compared with some of the
other options (like a segfault or overwriting:)

--bud

  



More information about the Fortran mailing list