GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
algol68 Performance Win

algol68: New 'whole' procedure implementation from Revised Report

Replaces the old 'whole' procedure with a more robust and efficient version based on the Algol68 Revised Report.

GCC’s Algol68 compiler has a new implementation for the whole procedure, based on the Revised Report. This version addresses a critical bug in the previous implementation where it failed for negative values closest to the minimum integer, due to an incorrect application of the ABS operator on two’s complement systems. The new implementation avoids ABS and processes numbers left-to-right, using string concatenation or length determination for efficiency, and is immune to the overflow issue with ABS(minimum_integer).

In Details

The whole procedure in Algol68 converts integers to strings. The previous implementation, found in the Revised Report (RR), suffered from an overflow when ABS was applied to the most negative integer representable in a two's complement system (e.g., -2^31 for a 32-bit signed integer). This commit introduces a reimplementation that processes the integer from left to right, avoiding ABS altogether and thus fixing this bug. It also offers performance improvements by determining the necessary buffer size upfront or using multiplication by powers of 10 instead of repeated string concatenatio…

For Context
whole procedure
An Algol68 procedure that converts an integer value into its string representation.
Revised Report
A subsequent version of the Algol68 language specification that includes corrections, clarifications, and extensions to the original report.
two's complement
A mathematical operation and binary representation method used to store signed integers in computers. It simplifies arithmetic operations.
ABS operator
The absolute value operator, which returns the non-negative value of a number.
Filed Under: algol68compiler buginteger conversion