https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115535

            Bug ID: 115535
           Summary: Image attribute on arrays incorrectly prints a signed
                    representation under certain conditions
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liam at liampwll dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

When calling 'Image on arrays containing range 0 .. 2**32 - 1 the output does
not match the output of 'Image for each element and instead outputs the value
interpreted as a signed 32 bit number.

GCC version: x64 13.2.0 from Alire on Linux and trunk on godbolt.org

Example built with gcc -c -I/app/ -g -fdiagnostics-color=always -S
-fverbose-asm -masm=intel -gnat2022 -o /app/example.s -I-:

with Ada.Text_IO; use Ada.Text_IO;
with System;

procedure Example is
    type Client_ID_Part is range 0 .. 2**32 - 1 with
      Size => 32;
   type Client_ID is array (1 .. 2) of Client_ID_Part;
    A : Client_ID := (1479222903, 3163714999);
begin
   Put_Line (A'Image);
   Put_Line (A (1)'Image);
   Put_Line (A (2)'Image);
end Example;

Actual output:

[ 1479222903, -1131252297]
 1479222903
 3163714999

Expected output:

[ 1479222903, 3163714999]
 1479222903
 3163714999

Reply via email to