This is the mail archive of the 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

On 07/08/2019 19:56, Steve Kargl wrote:
On Wed, Aug 07, 2019 at 09:09:49AM -0700, Steve Kargl wrote:
On Wed, Aug 07, 2019 at 01:58:17PM +0100, Mark Eggleston wrote:
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


   ''           0
Prior versions of gfortran give

% gfc9 -c a.f90

     3 |    data c / z'41424344' /
       |          1
Error: Incompatible types in DATA statement at (1); attempted conversion of INTEGER(16) to CHARACTER(1)

I have a patch that now does

gfcx -c a.f90

     3 |    data c / z'41424344' /
       |          1            2
Error: data-stmt-object at (1) has type 'CHARACTER', which conflicts with the BOZ literal constant at (2)

Is there any particular reason for reverting to the earlier behaviour instead of fixing the contents of c?

"C4102 (R463) A boz-literal-constant shall appear only as a data-stmt-constant in a DATA statement, or where explicitly allowed in subclause 13.7 as an actual argument of an intrinsic procedure." from the 2008 standard implies that the use of a BOZ in the data statement of a character variable is allowed, it doesn't say that it is restricted to numeric types.

BTW, -fallow-invalid-boz does enable all previous broken
usages of BOZ.

In that case comparisons with BOZ should be allowed but they are not as indicated in my previous e-mail



   For example, BOZ can be an actual argument
in only a few intrinsic subprograms listed in F2018.  I've
allowed only a few exceptions such as AND(z'1234',4242)
which mirros IAND() is documented behavior.

PS: Have you gotten write access to the source code repository, yet?


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