[Bug fortran/84382] add command-line options -std=gnu2003 and -std=gnu2008 for gfortran

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 4 23:40:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84382

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to janus from comment #2)
> (In reply to Dominique d'Humieres from comment #1)
> > Fortran is not C!
> 
> True. Fortran is not C is not C++. The main difference wrt this PR is
> possibly that the latter two have a large enough user base, so that a
> significant amount of people actually use the options mentioned above.
>

How do you propose to enforce a certain standard and allow
GNU extensions?  For example, -std=gnu2003 would enforce
Fortran 2003, but allow GNU extensions.  The problem is that
gfortran allows several extensions that violate the
standard.  A simple example is

  program foo
    integer :: i = z'1234'
    print *, i
  end program foo

% gfcx -o z a.f90 && ./z
        4660
% gfcx -o z -std=f2003 a.f90 && ./z
a.f90:2:18:

    2 |     integer :: i = z'1234'
      |                  1
Error: GNU Extension: BOZ literal at (1) outside a DATA statement
and outside INT/REAL/DBLE/CMPLX

gfortran even allows extensions that aren't caught by the -std
options and are not document!

  program foo
    integer :: i = 42
    print '(i0)', i + z'1234'
  end program foo

%gfcx -o z a.f90 && ./z
4702
% gfcx -o z -std=f2003 a.f90 && ./z
4702

I think it will becomes a endless discussion on what should
and should not be covered under -std=gnu2003.  What we have
now seems to be the most reasonable approach (with the 
available man power to address problem).  Either a user
wants GNU Fortran (ie., -std=gnu, the default behavior) or
a user wants a stricter adherence to a particular standard.

(For the record, I plan to remove both of the above extensions in 10.0).

> > WTF?
> 
> Giving that questions back to you, Dominique: WTF? Which problem do you
> think you solve by closing PRs that have not been fixed?

Yeah, I saw Dominique's comment #1, and thought that it might
be a tad bit over-the-top given the quality and quantity of
your contributions to gfortran.


More information about the Gcc-bugs mailing list