public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1796] Fortran: add DATA statement testcase
@ 2023-06-13 18:18 François-Xavier Coudert
0 siblings, 0 replies; only message in thread
From: François-Xavier Coudert @ 2023-06-13 18:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a54c71ccc24874ce79019b51150b3a00b7c785cd
commit r14-1796-ga54c71ccc24874ce79019b51150b3a00b7c785cd
Author: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Tue Jun 13 20:09:23 2023 +0200
Fortran: add DATA statement testcase
gcc/testsuite/
* gfortran.dg/data_array_7.f90: New test.
Diff:
---
gcc/testsuite/gfortran.dg/data_array_7.f90 | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/gcc/testsuite/gfortran.dg/data_array_7.f90 b/gcc/testsuite/gfortran.dg/data_array_7.f90
new file mode 100644
index 00000000000..56cd6ad3e23
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/data_array_7.f90
@@ -0,0 +1,26 @@
+! { dg-do run }
+!
+! Checking for "The new features of Fortran 2008" feature 5.6
+
+ implicit none
+ integer :: a(6)
+ integer :: b(6)
+ integer(kind=4) :: i
+
+ ! Fortran 2008: Subscripts in a data statement can be any constant expression
+ data a(kind("foo")) / 1 /
+ data a(sum([1, 2, 3]) / 3) / 2 /
+ data a(len("foo")) / 3 /
+ data a(kind(i)) / 4 /
+ data a(int(7.0 * atan(1.0)):6) / 5, 6 /
+
+ ! Fortran 2008: nested implied-do limits in a data statement can be any constant expression
+ data (b(i), i = kind("foo"), sum([-1, 1, 2])) / 1, 2 /
+ data (b(i), i = len("foo"), kind(i)) / 3, 4 /
+ data (b(i), i = int(7.0 * atan(1.0)), 6) / 5, 6 /
+
+ ! Check that data was correctly filled
+ if (any(a /= [(i, i = 1, 6)])) stop 1
+ if (any(b /= [(i, i = 1, 6)])) stop 1
+
+end
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-13 18:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-13 18:18 [gcc r14-1796] Fortran: add DATA statement testcase François-Xavier Coudert
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).