public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/62042] New: Missing optimization of copying non-limited objects
@ 2014-08-06 20:36 porton at narod dot ru
  2014-10-29 22:33 ` [Bug ada/62042] " porton at narod dot ru
  2015-04-23 23:02 ` porton at narod dot ru
  0 siblings, 2 replies; 3+ messages in thread
From: porton at narod dot ru @ 2014-08-06 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62042
           Summary: Missing optimization of copying non-limited objects
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: porton at narod dot ru

The below program, compiled with GNAT 4.9, calls Adjust two times when 
copying a T1 object.

But it does the same operations with a T2 object without calling Adjust.

So calling Adjust on a T1 object is here redundant and can be optimized away 
for greater performance. Ada Reference Manual allows this kind of optimization.

So GNAT is not as good as I expected, isn't it?

with Ada.Finalization;
with Ada.Text_IO;

procedure Main is

   type T1 is new Ada.Finalization.Controlled with null record;
   type T2 is new Ada.Finalization.Limited_Controlled with null record;

   overriding procedure Adjust(Object: in out T1) is
   begin
      Ada.Text_IO.Put_Line("Adjust");
   end;

   function F return T1 is
   begin
      return (Ada.Finalization.Controlled with null record);
   end;

   function F return T2 is
   begin
      return (Ada.Finalization.Limited_Controlled with null record);
   end;

   X: T1 := F;
   Y: T2 := F;

begin
   null;
end;
>From gcc-bugs-return-457922-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 06 21:33:10 2014
Return-Path: <gcc-bugs-return-457922-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8375 invoked by alias); 6 Aug 2014 21:33:10 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 8315 invoked by uid 48); 6 Aug 2014 21:33:05 -0000
From: "hp at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug regression/61510] [4.10 Regression]: 20_util/scoped_allocator/requirements/explicit_instantiation.cc and tr1/6_containers/tuple/requirements/explicit_instantiation.cc
Date: Wed, 06 Aug 2014 21:33:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: regression
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hp at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.10.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-61510-4-hzxe0lcTP2@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61510-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61510-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg00419.txt.bz2
Content-length: 663

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida510

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Hans-Peter Nilsson <hp at gcc dot gnu.org> ---
(In reply to jgreenhalgh from comment #7)
> This is now fixed on aarch64 and arm. Hans, do you still see it on cris?

Fixed for CRIS too, thanks.  BTW, it's ok to close once for all targets unless
some target difference has been noted earlier.


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

* [Bug ada/62042] Missing optimization of copying non-limited objects
  2014-08-06 20:36 [Bug ada/62042] New: Missing optimization of copying non-limited objects porton at narod dot ru
@ 2014-10-29 22:33 ` porton at narod dot ru
  2015-04-23 23:02 ` porton at narod dot ru
  1 sibling, 0 replies; 3+ messages in thread
From: porton at narod dot ru @ 2014-10-29 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Victor Porton <porton at narod dot ru> ---
Confirmed in GNAT GPL 2014.


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

* [Bug ada/62042] Missing optimization of copying non-limited objects
  2014-08-06 20:36 [Bug ada/62042] New: Missing optimization of copying non-limited objects porton at narod dot ru
  2014-10-29 22:33 ` [Bug ada/62042] " porton at narod dot ru
@ 2015-04-23 23:02 ` porton at narod dot ru
  1 sibling, 0 replies; 3+ messages in thread
From: porton at narod dot ru @ 2015-04-23 23:02 UTC (permalink / raw)
  To: gcc-bugs

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

Victor Porton <porton at narod dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.9.0                       |5.1.0

--- Comment #2 from Victor Porton <porton at narod dot ru> ---
Not fixed in 5.1.0.


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

end of thread, other threads:[~2015-04-23 23:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 20:36 [Bug ada/62042] New: Missing optimization of copying non-limited objects porton at narod dot ru
2014-10-29 22:33 ` [Bug ada/62042] " porton at narod dot ru
2015-04-23 23:02 ` porton at narod dot ru

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).