[Bug fortran/21459] New: Fortran runtime error: Unexpected end of format string

kamaraju at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon May 9 03:25:00 GMT 2005


Consider the following test code

program format_string
  implicit none
  character(len=*), parameter :: rform='(F15.5)', &
  cform="(' (', F15.5, ',' F15.5, ') ')"

  call print_a_number(cform)
contains
subroutine print_a_number(style)
  character(len=*) :: style
  write(*, style) cmplx(0.0, 0.0)
end subroutine print_a_number
end program format_string

This program compiles fine. But gives a runtime error.

$gfortran-20050507-1 -v
Using built-in specs.
Target: i486-linux
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang
--prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls
--program-suffix=-20050507-1 --enable-__cxa_atexit
--enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-gc=boehm --enable-java-awt=gtk --enable-mpfr --disable-werror
--disable-werror i486-linux
Thread model: posix
gcc version 4.1.0 20050507 (experimental)

$gfortran format_string.f90 -o format_string

$./a.out
At line 10 of file format_string.f90
Fortran runtime error: Unexpected end of format string
(' (',
      ^

I am using Debian Sid distribution, gcc-snapshot 20050507-1 package.

The above program compiles and runs fine with Absoft Fortran 90/95 compiler and
with intel fortran compiler 8.1 Build 20040921. The interaction with Absoft
compiler looks as follows

$f90 format_string.f90
rajulocal@kusumanchi:~/work/fortran/gfortran_bugs 28  527 11:21 PM
$./a.out
 (        0.00000,        0.00000)

-- 
           Summary: Fortran runtime error: Unexpected end of format string
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kamaraju at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21459



More information about the Gcc-bugs mailing list