diff options
author | Harald Anlauf <anlauf@gmx.de> | 2024-04-23 20:21:43 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2024-04-23 20:21:43 +0200 |
commit | 0bf94da59feab2c72a02c91df310a36d33dfd1f7 (patch) | |
tree | 5a8b759e4891501993587c722b9afab8c12dd61e | |
parent | 4f9401d1a802325e5dfa2db841945e1a9c59a980 (diff) | |
download | gcc-0bf94da59feab2c72a02c91df310a36d33dfd1f7.zip gcc-0bf94da59feab2c72a02c91df310a36d33dfd1f7.tar.gz gcc-0bf94da59feab2c72a02c91df310a36d33dfd1f7.tar.bz2 |
Fortran: check C_SIZEOF on additions from TS29113/F2018 [PR103496]
gcc/testsuite/ChangeLog:
PR fortran/103496
* gfortran.dg/c_sizeof_8.f90: New test.
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_sizeof_8.f90 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_8.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_8.f90 new file mode 100644 index 0000000..0ae2844 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_sizeof_8.f90 @@ -0,0 +1,23 @@ +! { dg-do run } +! +! PR fortran/103496 +! +! Test that C_SIZEOF returns the expected results + +program pr103496 + use iso_c_binding + implicit none + integer :: a(6) + integer, pointer :: p(:) + + if (c_sizeof(a) /= 6*4) stop 1 + if (c_sizeof(a(1)) /= 4) stop 2 + if (c_sizeof(a(:)) /= 6*4) stop 3 + if (c_sizeof(a(2::2)) /= 3*4) stop 4 + + allocate(p(5)) + if (c_sizeof(p) /= 5*4) stop 5 + if (c_sizeof(p(1)) /= 4) stop 6 + if (c_sizeof(p(:)) /= 5*4) stop 7 + if (c_sizeof(p(2::2)) /= 2*4) stop 8 +end |