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


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
> > 
> > Outputs:
> > 
> >   ''           0

Prior versions of gfortran give

% gfc9 -c a.f90
a.f90:3:10:

    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
a.f90:3:10-23:

    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)

BTW, -fallow-invalid-boz does enable all previous broken 
usages of BOZ.  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?

-- 
Steve


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