public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9381] modula2: Add constant aggregate tests
@ 2024-03-08  6:27 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2024-03-08  6:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:131d1753ac71eb62f0b14fa9a1cb0e125e9a3ca1

commit r14-9381-g131d1753ac71eb62f0b14fa9a1cb0e125e9a3ca1
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Fri Mar 8 06:26:55 2024 +0000

    modula2: Add constant aggregate tests
    
    This patch adds four constant aggregate tests and assignment of
    arrays by a constant in two different scopes.
    
    gcc/testsuite/ChangeLog:
    
            * gm2/iso/pass/arrayconst.mod: New test.
            * gm2/iso/pass/arrayconst2.mod: New test.
            * gm2/iso/pass/arrayconst3.mod: New test.
            * gm2/iso/pass/arrayconst4.mod: New test.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/testsuite/gm2/iso/pass/arrayconst.mod  | 31 ++++++++++++++++++++++++++
 gcc/testsuite/gm2/iso/pass/arrayconst2.mod | 31 ++++++++++++++++++++++++++
 gcc/testsuite/gm2/iso/pass/arrayconst3.mod | 35 ++++++++++++++++++++++++++++++
 gcc/testsuite/gm2/iso/pass/arrayconst4.mod | 35 ++++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+)

diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst.mod b/gcc/testsuite/gm2/iso/pass/arrayconst.mod
new file mode 100644
index 00000000000..05ce4c911d1
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst.mod
@@ -0,0 +1,31 @@
+MODULE arrayconst ;
+
+
+PROCEDURE foo ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END foo ;
+
+
+PROCEDURE bar ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {5.0, 6.0, 7.0, 8.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst.
diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst2.mod b/gcc/testsuite/gm2/iso/pass/arrayconst2.mod
new file mode 100644
index 00000000000..cee4b1457cb
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst2.mod
@@ -0,0 +1,31 @@
+MODULE arrayconst ;
+
+
+PROCEDURE foo ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END foo ;
+
+
+PROCEDURE bar ;
+TYPE
+   array = ARRAY [0..3] OF REAL ;
+CONST
+   value = array {5.0, 6.0, 7.0, 8.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst.
diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst3.mod b/gcc/testsuite/gm2/iso/pass/arrayconst3.mod
new file mode 100644
index 00000000000..0402e6f6bac
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst3.mod
@@ -0,0 +1,35 @@
+MODULE arrayconst3 ;
+
+
+PROCEDURE foo ;
+CONST
+   len = 4 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END foo ;
+
+
+PROCEDURE bar ;
+CONST
+   len = 2 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {5.0, 6.0} ;
+VAR
+   r: REAL ;
+BEGIN
+   r := value[1] ;
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst3.
diff --git a/gcc/testsuite/gm2/iso/pass/arrayconst4.mod b/gcc/testsuite/gm2/iso/pass/arrayconst4.mod
new file mode 100644
index 00000000000..0b14229cd8a
--- /dev/null
+++ b/gcc/testsuite/gm2/iso/pass/arrayconst4.mod
@@ -0,0 +1,35 @@
+MODULE arrayconst4 ;
+
+
+PROCEDURE foo ;
+CONST
+   len = 4 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {1.0, 2.0, 3.0, 4.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END foo ;
+
+
+PROCEDURE bar ;
+CONST
+   len = 2 ;
+TYPE
+   array = ARRAY [0..len -1] OF REAL ;
+CONST
+   value = array {5.0, 6.0} ;
+VAR
+   c: array ;
+BEGIN
+   c := value
+END bar ;
+
+
+BEGIN
+   foo ;
+   bar
+END arrayconst4.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-08  6:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08  6:27 [gcc r14-9381] modula2: Add constant aggregate tests Gaius Mulley

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).