[Bug ada/15807] New: Legal program runs incorrectly, RM 3.10.2(3,29)
ludovic dot brenta at insalien dot org
gcc-bugzilla@gcc.gnu.org
Thu Jun 3 19:22:00 GMT 2004
(Debian bug #246390)
-- RM 3.10.2(3)
-- The accessibililty rules, which prevent dangling references, are written
-- in terms of accessibility levels,...
-- RM 3.10.2(29)
-- A check is made that the accessibility level of X is not deeper than
-- that of the access type A. If this check fails, Program_Error is
-- raised.
with Text_IO; use Text_IO;
procedure Test_246390 is
type T1 is tagged null record;
type T2 is new T1 with record
A : aliased T1;
end record;
type T1_Access is access all T1'Class;
X : T1_Access;
procedure Test_Access (Param: access T2) is
begin
X := Param.A'Access;
end Test_Access;
procedure Inner_Proc is
Inner : aliased T2;
begin
-- X := Inner.A'access; -- this case caught at compile time
Test_Access (Inner'access); -- equivalent run-time case not caught
Put_Line ("failed: program_error not raised");
exception
when Program_Error =>
Put_Line("passed");
when others =>
Put_Line ("failed: other exception raised");
end;
begin
Inner_Proc;
end Test_246390;
The program should print "passed", but it prints:
failed: program_error not raised
--
Summary: Legal program runs incorrectly, RM 3.10.2(3,29)
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic dot brenta at insalien dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15807
More information about the Gcc-bugs
mailing list