public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "simon at pushface dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/112461] New: [14 regression] Simple return inside extended return loses updates to return object value
Date: Thu, 09 Nov 2023 15:01:03 +0000	[thread overview]
Message-ID: <bug-112461-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2023-11-09 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 15:01 simon at pushface dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112461-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).