On Fri, Oct 06, 2017 at 09:30:06PM -0700, Jerry DeLisle wrote: > On 10/06/2017 01:34 PM, Steve Kargl wrote: > > All, > > > > I have spent the last few days trying to reconcile the various Fortran > > standards' requirements for handling BOZ. The short story is that J3 > > over the last 27 years has made incompatible changes to the interpretation > > of a BOZ (under some circumstances). The interpretations in F2008 and > > F2015 now treat a boz-literal-constant as a sequence of bits. > > Unfortunately, > > due to quirks in how BOZ are currently implemented in gfortran and a boat > > load of documented and undocumented extensions, bringing gfortran into > > agreement with F2008/F2015 led to a rewrite of BOZ handling. In the > > rewrite I have made no attempt to use the -std= option to try to maintain > > the incompatibilities between standards. > > > > The patch tests OK on trunk with linux-x86_64. I suggest this be > committed as is and then see if there is any fallout that can be > dealt with -std=legacy or similar later. >
Thanks, but unfortunately in my review of the patch and F2008/F2015 found an issue. integer :: i = int(z'123456789',4) isn't handled correctly. We do get a silly error. % gfcx -c a.f90 a.f90:1:19: integer :: i = int(z'123456789',4) 1 Error: Arithmetic overflow converting INTEGER(-1) to INTEGER(4) at (1). This check can be disabled with the option '-fno-range-check' F2008 13.3.3 has When a boz-literal-constant is the argument A of the intrinsic function INT or REAL, ... if the length of the sequence of bits specified by A is greater than the size in bits of a scalar variable of the same type and kind type parameter as the result, the boz-literal-constant is treated as if it were truncated from the left to a length equal to the size in bits of the result. C1301 If a boz-literal-constant is truncated as an argument to the intrinsic function REAL, the discarded bits shall all be zero. We handle C1301 correctly except the error message could be better. % gfcx -c a.f90 a.f90:1:17: real :: i = real(z'123456789',4) 1 Error: BOZ constant at (1) is too large (33 vs 32 bits) -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow