On Wed, May 29, 2019 at 01:15:52PM +0200, Thomas Koenig wrote:
> 
> the attached patch fixes the wrong-code regression due to the
> inline argument repacking patch, r271377.
> 
> What had gone wrong?  gfortran used to pack and  unpack arrays
> unconditionally passed to old-style assumed size or .  For code like
> 
> module t2
>    implicit none
> contains
>    subroutine foo(a)
>      real, dimension(*) :: a
>    end subroutine foo
> end module t2
> 
> module t1
>    use t2
>    implicit none
> contains
>    subroutine bar(a)
>      real, dimension(:) :: a
>      call foo(a)
>    end subroutine bar
> end module t1
> 
> program main
>    use t1
>    call bar([1.0, 2.0])
> end program main
> 
> this meant that an (always contiguous) array constructor was
> passed down to an assumed shape array, which then passed it
> on to an assumed size, explicit shape or adjustable array.
> Packing was not problematic (apart from performance), but
> unpacking tried to write into the array constructor.
> 
> So, this patch inserts a run-time check for contiguous arrays
> and does not do packing/unpacking in that case.
> 
> Thanks to Toon and Martin for finding an open test case which
> actually failed, and for help with debugging.
> 
> (Always repacking also likely impacted performance when it didn't
> lead to wrong code, we will have to see how performance is with
> this version).
> 
> OK for trunk?
> 

Yes.

Thomas and Martin thanks for the effort required with debugging
the SPEC benchmark codes.

-- 
Steve

Reply via email to