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

            Bug ID: 113536
           Summary: valid reduction expression rejected by -gnatVo
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: devotus at yahoo dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

The legal program below fails to compile when `-gnatVo` is active. The error
message is

    test_reduction.adb:13:15: error: missing argument for parameter
"Accumulator" in call to "Do_Something" declared at line 9

The error seems to date back at least to gnat 10.2.

pragma Ada_2022;

with Ada.Text_IO;

procedure Test_Reduction is

   subtype Value is Natural range 0 .. 255;

   function Do_Something (Accumulator : Value; Symbol : Character) return Value
   is (((Accumulator + Character'Pos (Symbol)) * 17) mod 256);

   function Do_It_By_Reduction (S : String) return Value is
   (S'Reduce (Do_Something, 0));

   Test_It : constant Value := Do_It_By_Reduction ("Hello, world!");

begin

   Ada.Text_IO.Put_Line (Test_It'Image);

end Test_Reduction;

Reply via email to