re PR fortran/55072 (Missing internal_pack leads to wrong code with derived type)
2013-01-12 Janus Weil <janus@gcc.gnu.org> PR fortran/55072 * trans-array.c (gfc_conv_array_parameter): No packing was done for full arrays of derived type. 2013-01-12 Janus Weil <janus@gcc.gnu.org> PR fortran/55072 * gfortran.dg/assumed_type_2.f90: Fix test case. * gfortran.dg/internal_pack_13.f90: New test. * gfortran.dg/internal_pack_14.f90: New test. From-SVN: r195125
This commit is contained in:
parent
f5acf0f24b
commit
ea73447aa3
|
@ -1,3 +1,9 @@
|
|||
2013-01-12 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/55072
|
||||
* trans-array.c (gfc_conv_array_parameter): No packing was done for
|
||||
full arrays of derived type.
|
||||
|
||||
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/55868
|
||||
|
|
|
@ -7002,20 +7002,14 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
|
|||
this_array_result = false;
|
||||
|
||||
/* Passing address of the array if it is not pointer or assumed-shape. */
|
||||
if (full_array_var && g77 && !this_array_result)
|
||||
if (full_array_var && g77 && !this_array_result
|
||||
&& sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS)
|
||||
{
|
||||
tmp = gfc_get_symbol_decl (sym);
|
||||
|
||||
if (sym->ts.type == BT_CHARACTER)
|
||||
se->string_length = sym->ts.u.cl->backend_decl;
|
||||
|
||||
if (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS)
|
||||
{
|
||||
gfc_conv_expr_descriptor (se, expr);
|
||||
se->expr = gfc_conv_array_data (se->expr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sym->attr.pointer
|
||||
&& sym->as
|
||||
&& sym->as->type != AS_ASSUMED_SHAPE
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2013-01-12 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/55072
|
||||
* gfortran.dg/assumed_type_2.f90: Fix test case.
|
||||
* gfortran.dg/internal_pack_13.f90: New test.
|
||||
* gfortran.dg/internal_pack_14.f90: New test.
|
||||
|
||||
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/55868
|
||||
|
|
|
@ -157,7 +157,7 @@ end
|
|||
! { dg-final { scan-tree-dump-times "sub_scalar .\\(struct t1 .\\) array_class_t1_alloc._data.data" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_scalar .\\(struct t1 .\\) array_class_t1_ptr._data.dat" 1 "original" } }a
|
||||
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(D" 2 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(D" 3 "original" } }
|
||||
! { dg-final { scan-tree-dump-times " = _gfortran_internal_pack \\(&parm" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(&array_int\\)" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(real\\(kind=4\\).0:. . restrict\\) array_real_alloc.data" 1 "original" } }
|
||||
|
@ -165,7 +165,6 @@ end
|
|||
! { dg-final { scan-tree-dump-times "\\.data = \\(void .\\) &array_t1.0.;" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) parm" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t2.0:. . restrict\\) array_t2_alloc.data\\);" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t3.0:. .\\) array_t3_ptr.data\\);" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. . restrict\\) array_class_t1_alloc._data.data\\);" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "sub_array_assumed \\(\\(struct t1.0:. .\\) array_class_t1_ptr._data.data\\);" 1 "original" } }
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
! { dg-do run }
|
||||
!
|
||||
! PR 55072: [4.6/4.7/4.8 Regression] Missing internal_pack leads to wrong code with derived type
|
||||
!
|
||||
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
|
||||
|
||||
implicit none
|
||||
type t
|
||||
integer :: i
|
||||
end type t
|
||||
type(t), target :: tgt(4,4)
|
||||
type(t), pointer :: p(:,:)
|
||||
integer :: i,j,k
|
||||
|
||||
k = 1
|
||||
do i = 1, 4
|
||||
do j = 1, 4
|
||||
tgt(i,j)%i = k
|
||||
k = k+1
|
||||
end do
|
||||
end do
|
||||
|
||||
p => tgt(::2,::2)
|
||||
print *,p%i
|
||||
call bar(p)
|
||||
|
||||
contains
|
||||
|
||||
subroutine bar(x)
|
||||
type(t) :: x(*)
|
||||
print *,x(1:4)%i
|
||||
if (any (x(1:4)%i /= [1, 9, 3, 11])) call abort()
|
||||
end subroutine
|
||||
end
|
|
@ -0,0 +1,34 @@
|
|||
! { dg-do run }
|
||||
!
|
||||
! PR 55072: [4.6/4.7/4.8 Regression] Missing internal_pack leads to wrong code with derived type
|
||||
!
|
||||
! Contributed by Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
program GiBUU_neutrino_bug
|
||||
|
||||
Type particle
|
||||
integer :: ID
|
||||
End Type
|
||||
|
||||
type(particle), dimension(1:2,1:2) :: OutPart
|
||||
|
||||
OutPart(1,:)%ID = 1
|
||||
OutPart(2,:)%ID = 2
|
||||
|
||||
call s1(OutPart(1,:))
|
||||
|
||||
contains
|
||||
|
||||
subroutine s1(j)
|
||||
type(particle) :: j(:)
|
||||
print *,j(:)%ID
|
||||
call s2(j)
|
||||
end subroutine
|
||||
|
||||
subroutine s2(k)
|
||||
type(particle) :: k(1:2)
|
||||
print *,k(:)%ID
|
||||
if (any (k(1:2)%ID /= [1, 1])) call abort()
|
||||
end subroutine
|
||||
|
||||
end
|
Loading…
Reference in New Issue