]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: fix `int * char' lowerer
authorJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 9 Dec 2025 22:53:24 +0000 (23:53 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Wed, 10 Dec 2025 16:21:36 +0000 (17:21 +0100)
This commit fixes the asserts in a68_loer_char_mult3 so it expects
either int*char or char*int.  It also expands the mult-char-1.a68
testcase to cover this case.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68-low-prelude.cc (a68_lower_char_mult3): Fix asserts.

gcc/testsuite/ChangeLog

* algol68/execute/mult-char-1.a68: Cover int*char cases.

gcc/algol68/a68-low-prelude.cc
gcc/testsuite/algol68/execute/mult-char-1.a68

index 55c0895bec52414e643368460ab0423b5f7caace..bd54b207fbe27ae45535a88a33c1b027d21acf65 100644 (file)
@@ -944,7 +944,7 @@ a68_lower_char_mult3 (NODE_T *p, LOW_CTX_T ctx)
 
   if (MOID (n1) == M_INT)
     {
-      gcc_assert (MOID (n2) == M_STRING || MOID (n2) == M_ROW_CHAR);
+      gcc_assert (MOID (n2) == M_CHAR);
       return a68_string_mult (a68_string_from_char (a68_lower_tree (n2, ctx)),
                              a68_lower_tree (n1, ctx));
     }
index 0e3c1f4b93f06a79f1eb8c1065cba66e1c870714..67af07323b4a8a57be39b4f4684c81a3b0f41222 100644 (file)
@@ -1,5 +1,8 @@
 # { dg-options "-fstropping=upper" }  #
 BEGIN ASSERT ("a" * 3 = "aaa");
       ASSERT ("" * 1 = "");
-      ASSERT ("x" * 0 = "x")
+      ASSERT ("x" * 0 = "x");
+      ASSERT (3 * "a" = "aaa");
+      ASSERT (1 * "" = "");
+      ASSERT (0 * "x" = "x")
 END