aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/storage_size_2.f08
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/storage_size_2.f08')
-rw-r--r--gcc/testsuite/gfortran.dg/storage_size_2.f0827
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/storage_size_2.f08 b/gcc/testsuite/gfortran.dg/storage_size_2.f08
new file mode 100644
index 00000000000..50de9575e74
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/storage_size_2.f08
@@ -0,0 +1,27 @@
+! { dg-do compile }
+!
+! PR 44649: [OOP] F2008: storage_size intrinsic
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+use iso_c_binding, only: c_int
+
+type, bind(c) :: t
+ integer(c_int) :: j
+end type
+
+integer(4) :: i1
+integer(c_int) :: i2
+type(t) :: x
+
+print *,c_sizeof(i1) ! { dg-error "must be be an interoperable data entity" }
+print *,c_sizeof(i2)
+print *,c_sizeof(x)
+print *, c_sizeof(ran()) ! { dg-error "must be be an interoperable data entity" }
+
+print *,storage_size(1.0,4)
+print *,storage_size(1.0,3.2) ! { dg-error "must be INTEGER" }
+print *,storage_size(1.0,(/1,2/)) ! { dg-error "must be a scalar" }
+print *,storage_size(1.0,irand()) ! { dg-error "must be a constant" }
+
+end