public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/33889]  New: Inefficient code expansion for extended return statement
@ 2007-10-25  2:40 vgodunko at rostel dot ru
  2007-12-02 22:14 ` [Bug ada/33889] " pinskia at gcc dot gnu dot org
  2008-05-12 22:06 ` charlet at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: vgodunko at rostel dot ru @ 2007-10-25  2:40 UTC (permalink / raw)
  To: gcc-bugs

For this simple code

package P is
   type T is limited interface;
   function F return not null access T'Class;
end P;

package body P is
   function X return not null access T'Class;
   pragma Import (C, X);
   function F return not null access T'Class is
   begin
      return Result : not null access T'Class := X do
         null;
      end return;
   end F;
end P;

GNAT generate to many RTL calls:

$ gcc -O2 -S -gnatdg p.adb

   function p__f return not null access p__t'class is

      procedure p__f___clean is
      begin
         system__soft_links__abort_defer.all;
         system__soft_links__complete_master.all;
         system__soft_links__abort_undefer.all;
         return;
      end p__f___clean;
   begin
      system__soft_links__enter_master.all;
      R3b : declare
         _master : constant integer := 
           system__soft_links__current_master.all;
         T4bM : integer renames _master;
         [subtype p__T1s is access not null p__TtC]
         result : not null not null access p__t'class := p__T1s!(
           $ada__tags__displace (system__address!(x), p__tP));
      begin
            null;
         return p__T1s!($ada__tags__displace (system__address!(result), 
           p__tP));
      end R3b;
   at end
      p__f___clean;
   end p__f;

Computation of accessibility level don't needed in this case.


-- 
           Summary: Inefficient code expansion for extended return statement
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vgodunko at rostel dot ru
  GCC host triplet: x86-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33889


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

end of thread, other threads:[~2008-05-12 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-25  2:40 [Bug ada/33889] New: Inefficient code expansion for extended return statement vgodunko at rostel dot ru
2007-12-02 22:14 ` [Bug ada/33889] " pinskia at gcc dot gnu dot org
2008-05-12 22:06 ` charlet at gcc dot gnu dot 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).