public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Gaius Mulley <gaius@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-9381] modula2: Add constant aggregate tests
Date: Fri,  8 Mar 2024 06:27:34 +0000 (GMT)	[thread overview]
Message-ID: <20240308062734.D481D3858D35@sourceware.org> (raw)

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.

                 reply	other threads:[~2024-03-08  6:27 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=20240308062734.D481D3858D35@sourceware.org \
    --to=gaius@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).