https://gcc.gnu.org/g:cb557adb00b69f75025485e991e07cb93008e029
commit r16-6880-gcb557adb00b69f75025485e991e07cb93008e029 Author: Jose E. Marchesi <[email protected]> Date: Sat Jan 17 23:50:31 2026 +0100 a68: do not use `^' for the pow operator The RR mentions all of "**", "^" and "UP" as the representation of the several pow operators for integral, real and complex operations. This patch removes "^" from the list (and a remnant of "UP") and thus frees that worthy character to be used for some other purpose in the future. Signed-off-by: Jose E. Marchesi <[email protected]> gcc/algol68/ChangeLog * a68-parser-prelude.cc (stand_prelude): Remove definitions for ^ operator. * ga68.texi (Real operators): Remove entries for ^. (Integral operators): Likewise. gcc/testsuite/ChangeLog * algol68/execute/pow-real-1.a68: Adapt test to use ** rather than ^ for pow operator. Diff: --- gcc/algol68/a68-parser-prelude.cc | 18 ------------------ gcc/algol68/ga68.texi | 5 +---- gcc/testsuite/algol68/execute/pow-real-1.a68 | 6 +++--- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/gcc/algol68/a68-parser-prelude.cc b/gcc/algol68/a68-parser-prelude.cc index b28df455aa2a..84d1e1eb68ba 100644 --- a/gcc/algol68/a68-parser-prelude.cc +++ b/gcc/algol68/a68-parser-prelude.cc @@ -518,7 +518,6 @@ stand_prelude (void) a68_prio ("SHR", 8); a68_prio ("UP", 8); a68_prio ("DOWN", 8); - a68_prio ("^", 8); a68_prio ("LWB", 8); a68_prio ("UPB", 8); a68_prio ("I", 9); @@ -634,7 +633,6 @@ stand_prelude (void) a68_op (A68_STD, "/=", m, a68_lower_int_ne3); m = a68_proc (M_SHORT_SHORT_INT, M_SHORT_SHORT_INT, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_int); - a68_op (A68_STD, "^", m, a68_lower_pow_int); /* SHORT INT operators. */ m = a68_proc (M_SHORT_INT, M_SHORT_INT, NO_MOID); a68_op (A68_STD, "+", m, a68_lower_confirm2); @@ -681,7 +679,6 @@ stand_prelude (void) a68_op (A68_STD, "GE", m, a68_lower_int_ge3); m = a68_proc (M_SHORT_INT, M_SHORT_INT, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_int); - a68_op (A68_STD, "^", m, a68_lower_pow_int); /* INT operators. */ m = a68_proc (M_INT, M_INT, NO_MOID); a68_op (A68_STD, "+", m, a68_lower_confirm2); @@ -716,7 +713,6 @@ stand_prelude (void) a68_op (A68_STD, "MOD", m, a68_lower_mod3); a68_op (A68_STD, "%*", m, a68_lower_mod3); a68_op (A68_STD, "**", m, a68_lower_pow_int); - a68_op (A68_STD, "^", m, a68_lower_pow_int); m = a68_proc (M_REAL, M_INT, M_INT, NO_MOID); a68_op (A68_STD, "/", m, a68_lower_rdiv3); m = a68_proc (M_REF_INT, M_REF_INT, M_INT, NO_MOID); @@ -778,7 +774,6 @@ stand_prelude (void) a68_op (A68_STD, "/", m, a68_lower_rdiv3); m = a68_proc (M_LONG_INT, M_LONG_INT, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_int); - a68_op (A68_STD, "^", m, a68_lower_pow_int); /* LONG LONG INT operators. */ m = a68_proc (M_LONG_LONG_INT, M_LONG_LONG_INT, NO_MOID); a68_op (A68_STD, "+", m, a68_lower_confirm2); @@ -826,7 +821,6 @@ stand_prelude (void) a68_op (A68_STD, "/=", m, a68_lower_int_ne3); m = a68_proc (M_LONG_LONG_INT, M_LONG_LONG_INT, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_int); - a68_op (A68_STD, "^", m, a68_lower_pow_int); /* SHORT SHORT BITS operators */ m = a68_proc (M_BOOL, M_SHORT_SHORT_BITS, M_SHORT_SHORT_BITS, NO_MOID); a68_op (A68_STD, "=", m, a68_lower_bit_eq3); @@ -1006,10 +1000,8 @@ stand_prelude (void) a68_op (A68_STD, "*", m, a68_lower_mult_real); a68_op (A68_STD, "/", m, a68_lower_div3); a68_op (A68_STD, "**", m, a68_lower_pow_real); - a68_op (A68_STD, "^", m, a68_lower_pow_real); m = a68_proc (M_REAL, M_REAL, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_real); - a68_op (A68_STD, "^", m, a68_lower_pow_real); m = a68_proc (M_REF_REAL, M_REF_REAL, M_REAL, NO_MOID); a68_op (A68_STD, "+:=", m, a68_lower_plusab3); a68_op (A68_STD, "-:=", m, a68_lower_minusab3); @@ -1041,7 +1033,6 @@ stand_prelude (void) a68_op (A68_STD, "*", m, a68_lower_mult_real); a68_op (A68_STD, "/", m, a68_lower_div3); a68_op (A68_STD, "**", m, a68_lower_pow_real); - a68_op (A68_STD, "^", m, a68_lower_pow_real); m = a68_proc (M_REF_LONG_REAL, M_REF_LONG_REAL, M_LONG_REAL, NO_MOID); a68_op (A68_STD, "+:=", m, a68_lower_plusab3); a68_op (A68_STD, "-:=", m, a68_lower_minusab3); @@ -1066,7 +1057,6 @@ stand_prelude (void) a68_op (A68_STD, "GE", m, a68_lower_real_ge3); m = a68_proc (M_LONG_REAL, M_LONG_REAL, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_real); - a68_op (A68_STD, "^", m, a68_lower_pow_real); /* LONG LONG REAL operators. */ m = a68_proc (M_LONG_REAL, M_LONG_LONG_REAL, NO_MOID); a68_op (A68_STD, "SHORTEN", m, a68_lower_shortenreal2); @@ -1085,7 +1075,6 @@ stand_prelude (void) a68_op (A68_STD, "*", m, a68_lower_mult_real); a68_op (A68_STD, "/", m, a68_lower_div3); a68_op (A68_STD, "**", m, a68_lower_pow_real); - a68_op (A68_STD, "^", m, a68_lower_pow_real); m = a68_proc (M_REF_LONG_LONG_REAL, M_REF_LONG_LONG_REAL, M_LONG_LONG_REAL, NO_MOID); a68_op (A68_STD, "+:=", m, a68_lower_plusab3); a68_op (A68_STD, "-:=", m, a68_lower_minusab3); @@ -1110,7 +1099,6 @@ stand_prelude (void) a68_op (A68_STD, "GE", m, a68_lower_real_ge3); m = a68_proc (M_LONG_LONG_REAL, M_LONG_LONG_REAL, M_INT, NO_MOID); a68_op (A68_STD, "**", m, a68_lower_pow_real); - a68_op (A68_STD, "^", m, a68_lower_pow_real); /* ROWS operators. */ m = a68_proc (M_INT, M_ROWS, NO_MOID); a68_op (A68_STD, "LWB", m, a68_lower_lwb2); @@ -1196,8 +1184,6 @@ stand_prelude (void) a68_op (A68_STD, "/", m); m = a68_proc (M_COMPLEX, M_COMPLEX, M_INT, NO_MOID); a68_op (A68_STD, "**", m); - a68_op (A68_STD, "UP", m); - a68_op (A68_STD, "^", m); m = a68_proc (M_REF_COMPLEX, M_REF_COMPLEX, M_COMPLEX, NO_MOID); a68_op (A68_STD, "+:=", m); a68_op (A68_STD, "-:=", m); @@ -1240,8 +1226,6 @@ stand_prelude (void) a68_op (A68_STD, "/", m); m = a68_proc (M_LONG_COMPLEX, M_LONG_COMPLEX, M_INT, NO_MOID); a68_op (A68_STD, "**", m); - a68_op (A68_STD, "UP", m); - a68_op (A68_STD, "^", m); m = a68_proc (M_BOOL, M_LONG_COMPLEX, M_LONG_COMPLEX, NO_MOID); a68_op (A68_STD, "=", m); a68_op (A68_STD, "EQ", m); @@ -1279,8 +1263,6 @@ stand_prelude (void) a68_op (A68_STD, "/", m); m = a68_proc (M_LONG_LONG_COMPLEX, M_LONG_LONG_COMPLEX, M_INT, NO_MOID); a68_op (A68_STD, "**", m); - a68_op (A68_STD, "UP", m); - a68_op (A68_STD, "^", m); m = a68_proc (M_BOOL, M_LONG_LONG_COMPLEX, M_LONG_LONG_COMPLEX, NO_MOID); a68_op (A68_STD, "=", m); a68_op (A68_STD, "EQ", m); diff --git a/gcc/algol68/ga68.texi b/gcc/algol68/ga68.texi index cca9428c90f8..57967dc037d9 100644 --- a/gcc/algol68/ga68.texi +++ b/gcc/algol68/ga68.texi @@ -2099,7 +2099,6 @@ target. @item @code{@B{shl}}, @code{@B{up}} @item @code{@B{shr}}, @code{@B{down}} @item @code{@B{up}}, @code{@B{down}} -@item @code{^} @item @code{@B{lwb}} @item @code{@B{upb}} @end itemize @@ -2232,7 +2231,6 @@ Dyadic operator that yields the integer division with real result of @end deftypefn @deftypefn Operator {} {**} {= (@B{l} @B{int} a, b) @B{l} @B{int}} -@deftypefnx Operator {} {^} {= (@B{l} @B{int} a, b) @B{l} @B{int}} Dyadic operator that yields @code{a} raised to the exponent @code{b}. @end deftypefn @@ -2366,12 +2364,10 @@ Dyadic operator that yields the realeger division with real result of @end deftypefn @deftypefn Operator {} {**} {= (@B{l} @B{real} a, b) @B{l} @B{real}} -@deftypefnx Operator {} {^} {= (@B{l} @B{real} a, b) @B{l} @B{real}} Dyadic operator that yields @code{a} raised to the real exponent @code{b}. @end deftypefn @deftypefn Operator {} {**} {= (@B{l} @B{real} a, @B{int} b) @B{l} @B{real}} -@deftypefnx Operator {} {^} {= (@B{l} @B{real} a, @B{int} b) @B{l} @B{real}} Dyadic operator that yields @code{a} raised to the integral exponent @code{b}. @end deftypefn @@ -3328,3 +3324,4 @@ sometimes be useful to look up both forms. @printindex cp @bye +b diff --git a/gcc/testsuite/algol68/execute/pow-real-1.a68 b/gcc/testsuite/algol68/execute/pow-real-1.a68 index 810287064851..69d84759080c 100644 --- a/gcc/testsuite/algol68/execute/pow-real-1.a68 +++ b/gcc/testsuite/algol68/execute/pow-real-1.a68 @@ -1,7 +1,7 @@ # { dg-options "-fstropping=upper" } # BEGIN REAL r0 = 2.0; LONG REAL rr0 = LONG 2.0; LONG LONG REAL rrr0 = LONG LONG 2.0; - REAL r1 = r0 ^ 2; REAL r2 = r0 ^ 3.0; - LONG REAL rr1 = rr0 ^ LONG 2; LONG REAL rr2 = rr0 ^ LONG 3.0; - LONG LONG REAL rrr1 = rrr0 ^ LONG LONG 2; LONG LONG REAL rrr2 = rrr0 ^ LONG LONG 3.0; + REAL r1 = r0 ** 2; REAL r2 = r0 ** 3.0; + LONG REAL rr1 = rr0 ** LONG 2; LONG REAL rr2 = rr0 ** LONG 3.0; + LONG LONG REAL rrr1 = rrr0 ** LONG LONG 2; LONG LONG REAL rrr2 = rrr0 ** LONG LONG 3.0; SKIP END
