This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Non conforming code or gfortran bug ?


Hello all

 Here is a sample program that illustrates the fact that gfortran
can't escape ' and "

 program escaping
    implicit none
    write(*,*) 'Hello \'World\''
    write(*,*) "Hello 'World'"
    write(*,*) "Hello \"World\""
    write(*,*) 'Hello "World"'
 end program escaping


 This compiles and runs fine with pgi and xlf returning:
  Hello 'World'
  Hello 'World'
  Hello "World"
  Hello "World"

 But gfortran fails to compile
 In file escaping.f90:3

    write(*,*) 'Hello \'World\''
                       1
 Error: Syntax error in WRITE statement at (1)
  In file escaping.f90:5

    write(*,*) "Hello \"World\""
                       1
 Error: Syntax error in WRITE statement at (1)

 Is escaping an extension (i.e. the code is non conforming) or is this
a gfortran bug ?

 Thanks for your replies.


                    Benjamin

 P.S.
 gfortran -v
 Using built-in specs.
 Target: i386-linux
 Configured with: ../gcc/configure --prefix=/tmp/gfortran-20051205
/irun --enable-languages=c,fortran --host=i386-linux
 Thread model: posix
 gcc version 4.2.0 20051205 (experimental)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]