This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/16085] New: Wrong output from legal program, dereferencing access all T'Class


with text_io;
procedure Test_248171 is
   package pak1 is

      type T1 is abstract tagged null record;
      type T1_ptr is access all T1'Class;

      procedure p2 (y: T1) is abstract;

      type T2 is abstract new T1 with null record;

      type T3 is new T2 with null record;

      type T4 is new T3 with private;
      type T4_ptr is access all T4;

      procedure p2 (y: T3);

   private
      type T4 is new T3 with null record;
      type T5 is new T4 with null record;
   end pak1;

   package body pak1 is
      procedure p2 (y: T3) is
      begin
         null;
      end;
   end pak1;

   use pak1;
   x: T4_ptr := new T4;
begin
   p2(T1_ptr(x).all);
   text_io.put_line("passed");
exception
   when others => text_io.put_line("failed");
end Test_248171;


The program shoud print "passed", instead it prints "failed".

-- 
           Summary: Wrong output from legal program, dereferencing access
                    all T'Class
           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=16085


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]