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

            Bug ID: 58339
           Summary: ASSOCIATE construct to arrays: Wrong results (pointer
                    to array/array descriptor issue?)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

>From Arjen Markus,  posted at 
https://groups.google.com/forum/#!topic/comp.lang.fortran/IMON4ZcWlCk

The following program should print
  1.0 0.0
  2.0 0.0
etc. - and it does so with Cray ftn, pgf95 and ifort, but with gfortran, the
output is mangled.

I am suspicious that it will require the new array descriptor (i.e.
non-element-based strides) but I might be wrong.

Possibly related to PR 58085.


program assoc
    implicit none

    type point
        real :: x, y
    end type point

    type(point), dimension(10) :: array

    !real, dimension(:), pointer :: x

    associate( x => array%x, y => array%y )
        x = (/ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 /)
        y = 0.0
    end associate

    write(*,'(2f10.4)') array
end program assoc

Reply via email to