public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/112461] New: [14 regression] Simple return inside extended return loses updates to return object value
@ 2023-11-09 15:01 simon at pushface dot org
  2023-11-10  8:16 ` [Bug ada/112461] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: simon at pushface dot org @ 2023-11-09 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-04 10:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 15:01 [Bug ada/112461] New: [14 regression] Simple return inside extended return loses updates to return object value simon at pushface dot org
2023-11-10  8:16 ` [Bug ada/112461] " rguenth at gcc dot gnu.org
2023-11-10 10:05 ` [Bug ada/112461] [14 regression] premature finalization with nested return inside extended one ebotcazou at gcc dot gnu.org
2023-11-10 10:06 ` ebotcazou at gcc dot gnu.org
2023-12-04 10:05 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).