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

            Bug ID: 112461
           Summary: [14 regression] Simple return inside extended return
                    loses updates to return object value
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

In a complicated extended return[1] with this structure

   --  Calculate the sum of the natural numbers up to & including the
   --  given limit.
   function Add (Up_To : Natural) return Natural is
      Round : Natural := 0;
   begin
      return Result : Natural := 0 do
         loop
            Result := Result + Round;
            if Round = Up_To then
               return;
            end if;
            Round := Round + 1;
         end loop;
      end return;
   end Add;

what was returned was the equivalent of the initial value (here, 0) rather 
than the value as updated in the loop (NB! this simple loop doesn’t fail, 
I only include it as an example, since I don’t have a simple reproducer).

The problem was introduced after 20231008.

[1]
https://github.com/alire-project/alire/blob/a69ac7c7a24590bdfe1ca77bcb60386551989696/src/alire/alire-properties-from_toml.adb#L14

Reply via email to