[Bug fortran/43158] No default integer descriptor width
kargl at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Feb 24 02:33:00 GMT 2010
------- Comment #1 from kargl at gcc dot gnu dot org 2010-02-24 02:33 -------
(In reply to comment #0)
> With the following code:
>
> INTEGER :: someint
> CHARACTER (LEN=40) :: strcounter
> WRITE(strcounter,'(I)') someint
>
> The error message is generated:
>
> WRITE(strcounter,'(I)') someint
> 1
> Error: Nonnegative width required in format string at (1)
>
> Which to me just suggests that gfortran does not have the (i believe) standard
> behavior of automatically assigning a width to the format descriptor based on
> the given integer. However, this only appears to be a problem when using a
> character variable/internal file.
>
It suggests to me that you need to read a book on Fortran or
the Standard. It also fails for writing to unit=6.
laptop:kargl[207] gfortran44 -o z a.f90
a.f90:2.11:
write(*,'(I)') i
1
Error: Nonnegative width required in format string at (1)
You can get want you by using 'write(strcounter,*) someint'
or 'write(strcounter,'(I0)') someint'.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43158
More information about the Gcc-bugs
mailing list