[J3] BOZ in an array constructor

Steven G. Kargl kargl at troutmask.apl.washington.edu
Sun Jul 7 15:43:40 EDT 2019


gfortran's handling of BOZ is rather broken, and I'm
currently investigating several fixes.  In writing 
a test program (assuming kind = 4 and 8 are valid), I 
came up with

program foo
  integer(kind=4) :: i(2) = int([z'1234', z'5678'])
  integer(kind=8) :: j(2) = int([integer(8) :: z'1234', z'5678'])
  print *, i
end program foo

It seems to me C7111 prevents the i(2) case and C7112 prevents
the j(2) case.  One would need to write

program foo
  integer(kind=4) :: i(2) = [int(z'1234'), int(z'5678')]
  integer(kind=8) :: j(2) = [integer(8) :: int(z'1234'), int(z'5678')]
  print *, i
end program foo

The j(2) case could also be written as

  integer(kind=8) :: j(2) = [int(z'1234', 8), int(z'5678, 8)]

Is my interpretation of C7111 and C7112 correct?

-- 
Steve


More information about the J3 mailing list