https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52279
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Jul 02, 2020 at 03:53:22PM +0000, jakub at gcc dot gnu.org wrote:
> 
> --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to kargl from comment #6)
> > There is no -fno-allow-invalid-boz option.  The option is
> > -fallow-invalid-boz.  fortan/lang.opt defines the options
> > with the RejectNegative annotation.
> 
> Why is it RejectNegative?

Because there is nothing to negate.

  real :: x = z'1234'
  end

is an invalid use of a BOZ.  gfortran 10.1 will issue an error
for this construct (and a number of previously documented and 
undocumented extensions).  Unfortunately, older vesions of
gfortran accepted the above without error or warning.  When I
fixed gfortran's handling of BOZ to conform to the Fortran
2008/2018 standard (i.e., emit an error for the above code),
I introduced -fallow-invalid-boz to down-grade the error to
a warning, so that older codes will compile.  

gfortran -c a.f90                                            <-- error
gfortran -c -fallow-invalid-boz a.f90                        <-- warning
gfortran -c -fallow-invalid-boz -fno-allow-invalid-boz a.f90 <-- stupidity

> Is there some other option that acts as it negative option?

IMO, there is nothing to negative.  If you don't want the
option, then don't use it.

> If it is just a standalone boolean option, it should have a negative,
> so that if e.g. one uses -fallow-invalid-boz in $FFLAGS for most of
> files in some project, but there is a specific one that shouldn't
> allow it, one can just append -fno-allow-invalid-boz for it to cancel
> the earlier option.

This makes no sense to me.  gfortran will accept valid uses of a BOZ
without any option.  If you add -fallow-invalid-boz to $FFLAGS,
then you're simply accepting invalid Fortran (with a warning) in
addition to valid Fortran.  If a programmer is adding a new file 
to a project and $FFLAGS includes -fallow-invalid-boz, then programmer
will get a warning about invalid code instead of an error.  The
programmer is informed about the issue, and can make the necessary 
change, e.g., 

   real :: x = real(z'1234', 4)
   end

in the new file.

The point of the option is to allow backwards compatibility,
but to be verbose about the invalid Fortran; hopefully, to 
encourage the programmer to fix their code.

Reply via email to