[COMMITTED] algol68: fix PLUSTO operator
chris hermansen
clhermansen@gmail.com
Tue Jul 15 02:03:13 GMT 2025
Works great, Jose, thank you so much!
On Mon, Jul 14, 2025 at 11:57 AM Jose E. Marchesi <jemarch@gnu.org> wrote:
>
> ---
> 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
>
>
--
Chris Hermansen · clhermansen "at" gmail "dot" com
C'est ma façon de parler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/algol68/attachments/20250714/8f511f96/attachment.htm>
More information about the Algol68
mailing list