From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2071) id A590E385840D; Tue, 23 Apr 2024 18:25:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A590E385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713896706; bh=C15B8rqq6w7loBfQwbK4DgTIrA3tFSstIr1a5yjoOgs=; h=From:To:Subject:Date:From; b=gXwEAHJPWRYP59a1JV7+rf32cMsVUgmGtTpH0XxVX4bedRdvpt+WSf9e1ay/J+My1 CxjcZvOyur0656mhmH1dC9W6mEx97GPYTZ1VLisEWVz+uOpj9Bm4KNzFfndSDvCTVN JtuC45TsHWa931kKyhbetmoPOx9DEAXu8gISSzs4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Harald Anlauf To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-10097] Fortran: check C_SIZEOF on additions from TS29113/F2018 [PR103496] X-Act-Checkin: gcc X-Git-Author: Harald Anlauf X-Git-Refname: refs/heads/master X-Git-Oldrev: 4f9401d1a802325e5dfa2db841945e1a9c59a980 X-Git-Newrev: 0bf94da59feab2c72a02c91df310a36d33dfd1f7 Message-Id: <20240423182506.A590E385840D@sourceware.org> Date: Tue, 23 Apr 2024 18:25:06 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0bf94da59feab2c72a02c91df310a36d33dfd1f7 commit r14-10097-g0bf94da59feab2c72a02c91df310a36d33dfd1f7 Author: Harald Anlauf Date: Tue Apr 23 20:21:43 2024 +0200 Fortran: check C_SIZEOF on additions from TS29113/F2018 [PR103496] gcc/testsuite/ChangeLog: PR fortran/103496 * gfortran.dg/c_sizeof_8.f90: New test. Diff: --- gcc/testsuite/gfortran.dg/c_sizeof_8.f90 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 00000000000..0ae284436d0 --- /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