diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-22 04:40:57 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-22 04:40:57 +0000 |
commit | 08b7970877ad39a6d4193dd9419cca038401f29b (patch) | |
tree | 389abe357363e85a6283e38c11d31b71d1521bdc /gcc/testsuite/gfortran.dg | |
parent | 61cf0455273741f22babe6fc00ea0b77d32c1784 (diff) | |
download | gcc-08b7970877ad39a6d4193dd9419cca038401f29b.tar.gz |
2013-10-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran 57893
* class.c : Include target-memory.h.
(gfc_find_intrinsic_vtab) Build a minimal expression so that
gfc_element_size can be used to obtain the storage size, rather
that the kind value.
2013-10-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran 57893
* gfortran.dg/unlimited_polymorphic_13.f90 : New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203915 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r-- | gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90 | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90 new file mode 100644 index 00000000000..8b764959c7e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_13.f90 @@ -0,0 +1,55 @@ +! { dg-do run } +! +! PR fortran/58793 +! +! Contributed by Vladimir Fuka +! +! Had the wrong value for the storage_size for complex +! +module m + use iso_fortran_env + implicit none + integer, parameter :: c1 = real_kinds(1) + integer, parameter :: c2 = real_kinds(2) + integer, parameter :: c3 = real_kinds(size(real_kinds)-1) + integer, parameter :: c4 = real_kinds(size(real_kinds)) +contains + subroutine s(o, k) + class(*) :: o + integer :: k + integer :: sz + + select case (k) + case (4) + sz = 32*2 + case (8) + sz = 64*2 + case (10,16) + sz = 128*2 + case default + call abort() + end select + + if (storage_size(o) /= sz) call abort() + select type (o) + type is (complex(c1)) + if (storage_size(o) /= sz) call abort() + type is (complex(c2)) + if (storage_size(o) /= sz) call abort() + end select + select type (o) + type is (complex(c3)) + if (storage_size(o) /= sz) call abort() + type is (complex(c4)) + if (storage_size(o) /= sz) call abort() + end select + end subroutine s +end module m + +program p + use m + call s((1._c1, 2._c1), c1) + call s((1._c2, 2._c2), c2) + call s((1._c3, 2._c3), c3) + call s((1._c4, 2._c4), c4) +end program p |