This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/33889] New: Inefficient code expansion for extended return statement
- From: "vgodunko at rostel dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Oct 2007 02:39:47 -0000
- Subject: [Bug ada/33889] New: Inefficient code expansion for extended return statement
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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