[PATCH, gfortran] Escalate failure when Hollerith constant to real conversion fails [PR103628]
Steve Kargl
sgk@troutmask.apl.washington.edu
Thu Mar 2 01:10:46 GMT 2023
On Thu, Mar 02, 2023 at 01:07:32AM +0100, Bernhard Reutner-Fischer wrote:
> On Wed, 1 Mar 2023 07:39:40 -0800
> Steve Kargl via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> > In fact, Hollerith should be hidden behind a -fallow-hollerith
> > option and added to -std=legacy.
>
> While i'd be all for that, in my mind this will block off literally all
> consultants and quite some scientists unless we error out
> with a specific hint to an option that re-enable this.
>
> So yea, but please forgivingly for the decades to come?
>
It has already been decades. It seems to me that only
way to motivate people to fix their code is to nag.
Hollerith is pre-F77 era code. gfortran already provide a
warning. The warning should be made into an error, and yes,
it can point to -fallow-hollerith. The option would downgrade
the error to a warning. The only way to suppress the warning
is to suppress all warnings with -w. See -fallow-invalid-boz.
% cat > a.f90
program foo ! free-form source code is post-f77.
real :: b = 4H1234 ! No code, in particular, legacy has
print *, b ! initialization expressions.
end program foo
% gfcx -o z a.f90
a.f90:2:14:
2 | real :: b = 4H1234
| 1
Warning: Extension: Conversion from HOLLERITH to REAL(4) at (1)
a.f90:2:18:
2 | real :: b = 4H1234
| 1
Warning: Legacy Extension: Hollerith constant at (1)
--
Steve
More information about the Fortran
mailing list