$ cat a.f90 program test0 implicit none integer :: x = 1 write(*,*) cmplx(b'01000000001010010101001111111101',1,4) write(*,*) cmplx(b'01000000001010010101001111111101',x,4) end program test0 $ gfortran a.f90 $ ./a.out ( 2.6457512 , 1.00000000 ) ( 1.07645030E+09, 1.00000000 )
This is because we don't simplify the second case, and then we convert the boz, which is represented as a maximal-size integer, into a real; as the integer is too long, that doesn't work. I believe it's the only place that can happen, as for other intrinsics, there *always* is simplification in such a case. What we should do is not too clear to me, maybe a BOZ expert could help: one thing possible is to trap that case in the simplification routine, and even if we can't simplify the whole intrinsic, we silently convert the BOZ there; or we take care of it in trans-intrinsic.c. -- Summary: Wrong handling of BOZ in CMPLX Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36186