[Bug fortran/34139] New: gfortran.dg/subref_array_pointer_2.f90 fails on Intel Darwin9

dominiq at lps dot ens dot fr gcc-bugzilla@gcc.gnu.org
Sun Nov 18 11:03:00 GMT 2007


gfortran.dg/subref_array_pointer_2.f90 fails on Intel Darwin9 at all level of
optimization. The following reduced case shows the origin of the problem:

! { dg-do run }
! Test the fix for PRs29396, 29606, 30625 and 30871, in which pointers
! to arrays with subreferences did not work.
!
  type :: t
    real :: r
    integer :: i
    character(3) :: chr
  end type t

  type :: s
    type(t), pointer :: t(:)
  end type s

  type(t), target :: tar1(2) = (/t(1.0, 2, "abc"), t(3.0, 4, "efg")/)
  type(s), target :: tar3

  real, pointer :: ptr3(:)

!_______________something more complicated___________
  tar3%t => tar1
  ptr3 => tar3%t%r
  ptr3 = cos (ptr3)
  print *, ptr3
  print *, (/cos(1.0_4), cos(3.0_4)/)
  print *, any (ptr3 .ne. (/cos(1.0_4), cos(3.0_4)/))
  if (any (abs(tr3 - (/cos(1.0_4), cos(3.0_4)/)) < epsilon(1.0_4))) call abort
()
!  if (any (ptr3 .ne. (/cos(1.0_4), cos(3.0_4)/))) call abort ()

end

It succeeds as above, but fails with the last if uncommented because the value
of 'ptr3' corresponding to cos(1.0_4) differs by one lsb. 

  0.54030234     -0.98999250    
  0.54030228     -0.98999250    
 T

I have run the following test on OSX 10.4 and 10.5

integer :: i, n
real(4) :: x, y
real(8) :: c
n = 24
x = acos(-1.0)/2.0**n
y = 0
do i = 1, 2**n
   c = cos(real(i*x,8))
   y =max(y, abs(c-cos(i*x))/spacing(real(c)))
end do
print *, y
end

         y          time
10.4  0.499..97     2.71s
10.5  0.84559828    1.89s

So the new library seems slightly less accurate, but faster than
the old one.  This cold not probably considered as a bug, rather
a feature. This support some whishes to have OS independent libraries.

I think this could be fix by a fuzzy comparison for both real(4) and real(8),
even if the test succeeds in the later case.


-- 
           Summary: gfortran.dg/subref_array_pointer_2.f90 fails on Intel
                    Darwin9
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr
 GCC build triplet: i686-apple-darwin9
  GCC host triplet: i686-apple-darwin9
GCC target triplet: i686-apple-darwin9


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34139



More information about the Gcc-bugs mailing list