Desire to allocate bit in DT_PARM bitmask for DEC FORMAT compatibility purposes
Jakub Jelinek
jakub@redhat.com
Sat Mar 24 17:35:00 GMT 2018
On Sat, Mar 24, 2018 at 09:04:04AM -0700, Steve Kargl wrote:
> > Or shall we just check (warn_std & GFC_STD_LEGACY) != 0, if true,
> > set fmt->error if width etc. is missing, otherwise use the -1 and later
> > resolve it to the default?
>
> No. DEC extensions should be activated by the use of one of the
> -fdec-* options. For this extension, I think it can be grouped
> under the general purpose -fdec option. In the Fortran FE, -fdec
> then becomes "if (flag_dec)". I don't recall if Fritz set up
> passing flag_dec into libgfortran.
I don't see it passed directly.
With -fdec compile_options.warn_std is 0, rather than the default
GFC_STD_LEGACY | GFC_STD_F95_DEL, but _gfortran_set_options
argument is exactly the same for -fdec and for -std=legacy, so there is no
way to differentiate the two.
So, the only way to handle this DEC extension without adding new bits
(to either compile_options (i.e. GFC_STD_*), or the io flags as shown by the
patch Jeff posted) would be to abuse the IOPARM_dt_default_exp bit for it,
i.e. tie together the extension omitting exponent and the default width.
Seems the IOPARM_dt_default_exp is set whenever -fdec and not otherwise:
/* See if we want to use defaults for missing exponents in real transfers. */
if (flag_dec)
dt->default_exp = 1;
...
if (dt->default_exp)
mask |= IOPARM_dt_default_exp;
are the only spots that refer to default_exp in the FE.
If it is acceptable that users can't choose I want default widths but not
default exponent, or I want default exponent but not default width, then
yes, we can just check
dtp->common.flags & IOPARM_DT_DEFAULT_EXP
for whether default widths are allowed or not, rather than
dtp->common.flags & IOPARM_DT_DEFAULT_WIDTH
or
compile_options.allow_std & GFC_STD_DEC
> > Any way to deal with the FMT_L missing width inconsistency (libgfortran
> > under notify_std (..., GFC_STD_GNU, ...) using default length of 1 while
> > the other compilers all using 2?
>
> fmt->value = flag_dec ? 2 : 1; /* Default width */
flag_dec would need to be one of the above.
Jakub
More information about the Fortran
mailing list