GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/algol68

Fix handling of standard pow operators in Algol 68

Corrects operator lookup for 'pow' and related standard operators in Algol 68.

This commit addresses an issue in GCC’s Algol 68 compiler where the find_operator function did not correctly handle standard ‘pow’ operators and other cross-term operators. The Revised Report specifies abbreviated notations for these, implying type coercions. The compiler now correctly inlines these coercions, such as converting an int to real when a real and int operand are used with a power operator, rather than requiring explicit operator definitions for every type combination.

In Details

This patch modifies a68-parser-moids-check.cc in GCC's Algol 68 frontend to fix the find_operator logic. The issue was with handling standard operators, particularly 'pow' and similar dyadic operations, that have abbreviated definitions in the Algol 68 Revised Report (e.g., real P int -> real). The find_operator function needs to correctly apply implicit strong coercions (like int to real) at the point of operator lookup rather than expecting all variations to be explicitly defined. This improves the compiler's adherence to the Algol 68 standard for type promotions in expressions.

For Context
Algol 68
An influential, early high-level programming language known for its complex syntax and powerful features, including a flexible type system and support for parallel processing.
find_operator
A function within GCC's Algol 68 parser that determines which operator to use for a given set of operands, considering type compatibility and implicit coercions.
strong coercion
An automatic type conversion in Algol 68 that is guaranteed to succeed and preserve the value's meaning, such as converting an integer to a real number.
cross-term operators
In Algol 68, operators that can take operands of different, but compatible, basic types (e.g., adding a real and an integer). The language defines rules for coercing one type to match the other.
Filed Under: gccalgol68compiler