Bug 53800 - [OOP] Wrong copy-in/copy-out when passing CLASS array to assumed-shape TYPE
Summary: [OOP] Wrong copy-in/copy-out when passing CLASS array to assumed-shape TYPE
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2012-06-28 20:28 UTC by Tobias Burnus
Modified: 2015-10-14 18:50 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-10-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2012-06-28 20:28:25 UTC
The reason for problem is that we do not have a stride multiplier.

See http://j3-fortran.org/pipermail/j3/2012-June/005438.html and http://j3-fortran.org/pipermail/j3/2012-June/005445.html

program class_to_type
   implicit none
   type t
     integer :: i
   end type t
   type, extends(t) :: t2
     integer :: j
   end type t2
   class(t), target, allocatable :: A(:,:)
   type(t), pointer :: ptr

   allocate(t2 :: A(5,5))
   a(:,:)%i = 53
   a(3,3)%i = 42
   a(4,4)%i = 74

   call f(a)
   print *,ptr%i
   a(3,3)%i = 999
   print *,ptr%i
contains
   subroutine f(x)
     type(t), target :: x(:,:)
     ptr => x(3,3)
   end subroutine f
end program class_to_type
Comment 1 Dominique d'Humieres 2012-06-28 20:35:58 UTC
Related to pr34640  and pr46339?
Comment 2 Dominique d'Humieres 2015-10-14 18:50:24 UTC
> See http://j3-fortran.org/pipermail/j3/2012-June/005438.html
> and http://j3-fortran.org/pipermail/j3/2012-June/005445.html

The links are broken. At r228818 the output of the code in comment 0 is still

          42
          42