[Patch, fortran] PR29786 - [4.1/4.2/4.3 Regression] Initialization of overlapping variables: Not implemented
Dominique Dhumieres
dominiq@lps.ens.fr
Tue Jun 12 13:12:00 GMT 2007
equiv_7.f90 fails on PPC. This seems to be related to endian problem:
! { dg-do run }
! Tests the fix for PR29786, in which initialization of overlapping
! equivalence elements caused a compile error.
!
! Contributed by Bernhard Fischer <aldot@gcc.gnu.org>
!
! This came up in PR29786 comment #9
!
! print *, d1mach (1), transfer ((/0_4, 1048576_4/), 1d0)
! print *, d1mach (2), transfer ((/-1_4, 2146435071_4/), 1d0)
print *, d1mach (1), transfer ((/1048576_4, 0_4/), 1d0)
print *, d1mach (2), transfer ((/2146435071_4, -1_4/), 1d0)
! if (d1mach (1) .ne. transfer ((/0_4, 1048576_4/), 1d0)) call abort ()
! if (d1mach (2) .ne. transfer ((/-1_4,2146435071_4/), 1d0)) call abort ()
!
contains
function d1mach(i)
implicit none
double precision d1mach,dmach(5)
integer i,large(4),small(4)
equivalence ( dmach(1), small(1) )
equivalence ( dmach(2), large(1) )
! data small(1),small(2) / 0, 1048576/
! data large(1),large(2) /-1,2146435071/
data small(2),small(1) / 0, 1048576/
data large(2),large(1) /-1,2146435071/
d1mach = dmach(i)
end function d1mach
end
yields
2.2250738585072014E-308 2.2250738585072014E-308
1.7976931348623157E+308 1.7976931348623157E+308
while the original code (commented lines) yields:
5.180654E-318 5.180654E-318
NaN NaN
the last two NaN make the test on d1mach (2) fails.
Dominique
More information about the Gcc-patches
mailing list