Bug 29625 - Octal edit descriptors allow real variables, even with -std=f95
Summary: Octal edit descriptors allow real variables, even with -std=f95
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 minor
Target Milestone: ---
Assignee: Tobias Burnus
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2006-10-27 23:52 UTC by Brooks Moses
Modified: 2006-10-28 21:44 UTC (History)
1 user (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2006-10-28 21:43:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brooks Moses 2006-10-27 23:52:42 UTC
(Fortran version: GNU Fortran 95 (GCC) 4.2.0 20061015 (experimental))

Consider the following program:

~/temp/gfortran> cat trans1.f90
    program trans1
      real :: a
      a = 1.
      write (*,"(10x, f9.5)" ) a
      write (*,"( 1x,  o20)" ) transfer(a, 0)
      write (*,"( 1x,  o20)" ) a
    end

According to the Fortran 95 standard (section 10.5.1.1), the output list item corresponding to an "O" edit descriptor shall be of integer type.  Although allowing real items is a perfectly reasonable extension when strict standard-conformance is not requested, when strict standard conformance is requested, the last of these write statements should produce an error.  However, it does not:

~/temp/gfortran> gfortran -std=f95 -Wall trans1.f90 -o trans1.exe
~/temp/gfortran> ./trans1
            1.00000
           7740000000
           7740000000
Comment 1 tobias.burnus 2006-10-28 13:34:31 UTC
Probably the same for binary and hexadecimal?

io/transfer.c(formatted_transfer_scalar): "case FMT_O:" seems to be a good place for adding notify_std (&dtp->common, GFC_STD_GNU,...)
Comment 2 Tobias Burnus 2006-10-28 21:05:51 UTC
Subject: Bug 29625

Author: burnus
Date: Sat Oct 28 21:05:42 2006
New Revision: 118111

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118111
Log:
2006-10-28 Tobias Burnus <burnus@net-b.de>

	PR fortran/29625
	* io/transfer.c (formatted_transfer_scalar): Allow binary edit
	  descriptors for real variables; give error for BOZ edit
	  descriptor for non-integers when using -std=f*.


Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/transfer.c

Comment 3 Tobias Burnus 2006-10-28 21:07:33 UTC
Subject: Bug 29625

Author: burnus
Date: Sat Oct 28 21:07:19 2006
New Revision: 118112

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118112
Log:
2006-10-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/29625
	* gfortran.dg/io_real_boz.f90: Add.
	* gfortran.dg/io_real_boz2.f90: Add.


Added:
    trunk/gcc/testsuite/gfortran.dg/io_real_boz.f90
    trunk/gcc/testsuite/gfortran.dg/io_real_boz2.f90
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 4 Tobias Burnus 2006-10-28 21:43:44 UTC
Fix checked in:

Author: burnus
Date: Sat Oct 28 21:05:42 2006
New Revision: 118111

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118111
Log:
2006-10-28 Tobias Burnus <burnus@net-b.de>

	PR fortran/29625
	* io/transfer.c (formatted_transfer_scalar): Allow binary edit
	  descriptors for real variables; give error for BOZ edit
	  descriptor for non-integers when using -std=f*.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/transfer.c

Author: burnus
Date: Sat Oct 28 21:07:19 2006
New Revision: 118112

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118112
Log:
2006-10-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/29625
	* gfortran.dg/io_real_boz.f90: Add.
	* gfortran.dg/io_real_boz2.f90: Add.

Added:
    trunk/gcc/testsuite/gfortran.dg/io_real_boz.f90
    trunk/gcc/testsuite/gfortran.dg/io_real_boz2.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 Tobias Burnus 2006-10-28 21:44:08 UTC
Mark fixed.