Bug 34392 - BOZ diagnost invalid Fortran 2003 use with -std=f2003 warnings
Summary: BOZ diagnost invalid Fortran 2003 use with -std=f2003 warnings
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, diagnostic
Depends on:
Blocks: F2003
  Show dependency treegraph
 
Reported: 2007-12-08 16:00 UTC by Tobias Burnus
Modified: 2019-01-20 23:55 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-29 09:18:38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-12-08 16:00:43 UTC
This assumes that the patch http://gcc.gnu.org/ml/fortran/2007-12/msg00075.html has been applied. It fixes most PR 34342, PR 34345, PR 18026 and PR 29471.

Missing:

-std=f2003 does not detect most invalid BOZ, only (i) BOZ for non-integers in DATA statements and (ii) in assignments () are detected.
Comment 1 Tobias Burnus 2007-12-17 09:49:26 UTC
NOTE: The Fortran 2003 has the specific function (of generic REAL) FLOAT and SNGL for which BOZ are not allowed.

FLOAT takes the same code path as REAL (w/o kind argument). With -std=f2003 a BOZ in FLOAD should be rejected.

For SNGL: It will probably solved by PR 34505, which should allow only real arguments for SNGL.

Currently, the gfortran documentation has:

"Since Fortran 2003 BOZ literals are also allowed as argument of REAL, DBLE, INT and CMPLX; the result is the same as if the integer BOZ literal had been converted by TRANSFER [...] The GNU Fortran intrinsic procedure FLOAT, DFLOAT, COMPLEX and DCMPLX are treated alike."
http://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html
Comment 2 Dominique d'Humieres 2015-09-03 21:58:35 UTC
> FLOAT takes the same code path as REAL (w/o kind argument). With -std=f2003
> a BOZ in FLOAD should be rejected.

For 4.6 up to trunk (6.0) with -std=f2003 I get

 print *, float(Z'3FFF0080')
               1
Error: GNU Extension: non-default INTEGER kind argument to float intrinsic at (1)

> For SNGL: It will probably solved by PR 34505, which should allow only
> real arguments for SNGL.

and

 print *, sngl(Z'3FFF000000000080')
              1
Error: 'a' argument of 'sngl' intrinsic at (1) must be REAL

4.3.1 up to 4.5 gives

print *, sngl(Z'3FFF000000000080')
             1
Error: Type of argument 'a' in call to 'sngl' at (1) should be REAL(8), not INTEGER(16)

What is missing?
Comment 3 Jürgen Reuter 2019-01-20 23:23:02 UTC
Looks like one needs to come up with a list of possible cases to find one that is not yet covered.
Comment 4 kargl 2019-01-20 23:55:21 UTC
(In reply to Jürgen Reuter from comment #3)
> Looks like one needs to come up with a list of possible cases to find one
> that is not yet covered.

BOZ handling needs to be rewritten.  I'll get to it one day.