This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Apr 2011 11:42:07 -0700
- Subject: [PATCH,Fortran] Handle 'q' exponent-letter in real-literal-constant
Historically, gfortran has accepted real-literal-constants
of the form 1.23Q45 as single precision values. Many commercial
compilers (dating back years) have used the 'Q' exponent-letter
to mean quadruple precision. With the addition of software
support for REAL(16) on i386 and x86_64 targets, I anticipate
an increase in use of the 'Q' form. The attached patch does
the following:
1) If REAL(16) is available, a real-literal-constant with a 'Q'
exponent-letter is accepted as a REAL(16) entity.
2) If REAL(16) is not available but REAL(10) is, then the constant
is accepted as a REAL(10).
3) If neither REAL(16) nor REAL(10) is available, an error is
issued.
4) An error is issued if one uses -std=f95, f2003, or f2008; otherwise
a warning will be issued. The only way to disable the warning is
to either fix the code to conform to the Fortran standard or use
-w to disable warnings.
5) If the constant has the form 1.23Q45_16 (ie., a integer kind
suffix is appended to the value), then an error is issued. This
is similar to the requirement that 1.23D45_xyz violated the
Fortran Standard.
The attached patch has been built and regression
tested on x86_64-*-freebsd. There were no regression
with the patch. OK for trunk (and 4.6 branch after
testing)?
2011-04-25 Steven G. Kargl <kargl@gcc.gnu.org.>
PR fortran/48720
* gfortran.texi: Document the 'Q' exponent-letter extension.
* primary.c (match_real_constant): Accept 'Q' as exponent-letter
for REAL(16) real-literal-constant with a fallback to REAL(10) or
error if REAL(10) is not available.
--
Steve