[COMMITTED] algol68: fix PLUSTO operator

Jose E. Marchesi jemarch@gnu.org
Mon Jul 14 18:57:21 GMT 2025


---
 gcc/algol68/a68-low-prelude.cc                    | 2 +-
 gcc/testsuite/algol68/execute/plusto-char-1.a68   | 4 ++--
 gcc/testsuite/algol68/execute/plusto-string-1.a68 | 9 ++++-----
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/gcc/algol68/a68-low-prelude.cc b/gcc/algol68/a68-low-prelude.cc
index a8d989319ab..944db198a83 100644
--- a/gcc/algol68/a68-low-prelude.cc
+++ b/gcc/algol68/a68-low-prelude.cc
@@ -909,7 +909,7 @@ a68_lower_string_plusto3 (NODE_T *p, LOW_CTX_T ctx)
   MOID_T *lhs_mode = MOID (lhs_node);
   NODE_T *rhs_node = SUB (p);
   tree rhs = a68_lower_tree (rhs_node, ctx);
-  tree operation = a68_string_concat (a68_low_deref (lhs, NEXT (NEXT (SUB (p)))), rhs);
+  tree operation = a68_string_concat (rhs, a68_low_deref (lhs, NEXT (NEXT (SUB (p)))));
 
   return fold_build2_loc (a68_get_node_location (p),
 			  COMPOUND_EXPR,
diff --git a/gcc/testsuite/algol68/execute/plusto-char-1.a68 b/gcc/testsuite/algol68/execute/plusto-char-1.a68
index 8af55f1144f..79881c07d10 100644
--- a/gcc/testsuite/algol68/execute/plusto-char-1.a68
+++ b/gcc/testsuite/algol68/execute/plusto-char-1.a68
@@ -1,7 +1,7 @@
 begin string foo := "foo";
       char c := "x";
       c PLUSTO foo;
-      assert (foo = "foox");
+      assert (foo = "xfoo");
       c +=: foo;
-      assert (foo = "fooxx")
+      assert (foo = "xxfoo")
 end
diff --git a/gcc/testsuite/algol68/execute/plusto-string-1.a68 b/gcc/testsuite/algol68/execute/plusto-string-1.a68
index 44566260810..7d5894b0cd4 100644
--- a/gcc/testsuite/algol68/execute/plusto-string-1.a68
+++ b/gcc/testsuite/algol68/execute/plusto-string-1.a68
@@ -1,7 +1,6 @@
-# { dg-options "-fstropping=upper" }  #
-BEGIN STRING foo := "foo";
+begin string foo := "foo";
       "bar" PLUSTO foo;
-      ASSERT (foo = "foobar");
+      assert (foo = "barfoo");
       "quux" +=: foo;
-      ASSERT (foo = "foobarquux")
-END
+      assert (foo = "quuxbarfoo")
+end
-- 
2.30.2



More information about the Algol68 mailing list