public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-10097] Fortran: check C_SIZEOF on additions from TS29113/F2018 [PR103496]
Date: Tue, 23 Apr 2024 18:25:06 +0000 (GMT)	[thread overview]
Message-ID: <20240423182506.A590E385840D@sourceware.org> (raw)

https://gcc.gnu.org/g:0bf94da59feab2c72a02c91df310a36d33dfd1f7

commit r14-10097-g0bf94da59feab2c72a02c91df310a36d33dfd1f7
Author: Harald Anlauf <anlauf@gmx.de>
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

                 reply	other threads:[~2024-04-23 18:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240423182506.A590E385840D@sourceware.org \
    --to=anlauf@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).