This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

Fortran G77 bug or feature?


The Fortran statements

      PRINT *, 'Hello World!'
      PRINT *, ' Hello World!'

should produce the output

ello World!
Hello World!

but instead it prints

Hello World!
 Hello World!

Another example, the program:

	print 10, ' 1'
10	format(a2,$)
	print 10, '+2'
	print 10, '+3'
	print 10, '+4'
	print 10, '+5'
	print 10, '+6'
	end

should produce the output:

123456

but using the g77 compiler it outputs:

 1+2+3+4+5+6

This is wrong!
If you look at section 12.9.5.2.3 (Printing of Formatted Records) in the
Fortran standard, it reads:

If a formatted record is printed, the first character of the record is not
printed.

The first character of such a record determines vertical spacing as follows:

                ________________________________________________
                |           |                                  |
                | Character | Vertical Spacing Before Printing |
                |___________|__________________________________|
                |           |                                  |
                |   Blank   | One Line                         |
                |     0     | Two Lines                        |
                |     1     | To First Line of Next Page       |
                |     +     | No Advance                       |
                |___________|__________________________________|

Is this a bug is the Force 2.0 environment I'm using or in the underlying
G77 compiler and run-time system?

Rien Timmer
The Netherlands

Fortran veteran of Digital Equipment Corporation's RSX and VMS systems.



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