This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Committed] PR fortran/54072 -- More fun with BOZ


Steve,

BOZ problems in the following areas

 * use of logical and character variables with BOZ constants
 * comparisons with BOZ constants
 * DATA statements

Comparing 9.1 and trunk:

character variables (9.1)

 * old style initialisation - not allowed (Incompatible types)
 * new style initialisation - not allowed (Cannot convert)
 * assignment - not allowed (Cannot convert)
 * DATA statement not allowed

character variables (trunk with -fallow-invalid-boz)

 * old style initialisation - not allowed (type mismatch)
 * new style initialisation - not allowed (Unclassifiable statement)
 * assignment - not allowed (Invalid use)
 * DATA statement allowed

logical variables (9.1)

 * old style initialisation - not allowed (Incompatible types)
 * new style initialisation - allowed with warning
 * assignment - allowed with warning
 * DATA statement not allowed (Incompatible types)

logical variables (trunk with -fallow-invalid-boz)

 * old style initialisation - not allowed (type mismatch)
 * new style initialisation - not allowed (Unclassifiable statement)
 * assignment - not allowed (invalid use)
 * DATA statement allowed

Comparisons with BOZ constants was allowed using 9.1 with -Wconversion-extra:

    5 |         if (i4 .eq. z'1000') then
      |            1
Warning: Conversion from INTEGER(4) to INTEGER(16) at (1) [-Wconversion-extra]

Using trunk  with -fallow-invalid-boz comparison is not allowed:

    5 |         if (i4 .eq. z'1000') then
      |            1
Error: Operands of comparison operator '.eq.' at (1) are INTEGER(4)/BOZ

I would have expected a suitable warning about using the BOZ in an inappropriate place.

DATA statements for logical and character variable compile but do not work:

program test
  character(4) :: c
  data c / z'41424344' /
  write(*, *) "'" // c // "'", transfer(c, 0_4)
end program test

Outputs:

 ''           0

program test
  logical(4) b / z'00000001' /
  write(*, *) b
end program test

Outputs:

 F

Apologies if this should have been reported via bugzilla. If so let me know and I'll submit it split into 2 or 3 bug reports.

The trunk compiler was built on x86_64 hardware using code from Subversion revision 274157.


regards,
Mark Eggleston


On 24/07/2019 00:05, Steve Kargl wrote:
I've committed the attached patch as a follow-up to
the recent BOZ (r273747).  It removes a few leftover
comments as well as fixes the PR.

2019-07-23  Steven G. Kargl  <kargl@gcc.gnu.org>

  PR fortran/54072
  * check.c (gfc_invalid_boz): Fix comment.
  (illegal_boz_arg): New function.
  (gfc_check_transfer): Use to arguments.
  (gfc_check_storage_size): Ditto.
  (gfc_check_complex): Remove leftover comment from BOZ patch.
  * primary.c (match_boz_constant): Remove leftover comment.


2019-07-23  Steven G. Kargl  <kargl@gcc.gnu.org>

  PR fortran/54072
  * gfortran.dg/illegal_boz_arg_1.f90: New tests.

--
https://www.codethink.co.uk/privacy.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]