[Bug ada/15918] New: Wrong output from legal program

ludovic dot brenta at insalien dot org gcc-bugzilla@gcc.gnu.org
Thu Jun 10 21:47:00 GMT 2004


with Ada.Finalization;
package pak1 is
   type T1 is tagged private;             -- not visibly controlled
private
   type T1 is new Ada.Finalization.Controlled with null record;
   procedure Initialize (Object : in out T1);
end pak1;

with text_io;
package body pak1 is
   procedure Initialize (Object : in out T1) is
   begin
      text_io.put_line("passed: T1 initialize called");
   end Initialize;
end pak1;

with pak1;
package pak2 is
   type T2 is new pak1.T1 with null record;
   procedure Initialize (Object : in out T2); -- not overriding
end pak2;

with text_io;
package body pak2 is
   procedure Initialize (Object : in out T2) is
   begin
      text_io.put_line("failed: T2 initialize called");
   end Initialize;
end pak2;

with pak2;
procedure Test_247565 is
   x: pak2.T2;
begin
   null;
end Test_247565;



The program compiles fine (with -q -O1), but outputs:
passed: T1 initialize called

-- 
           Summary: Wrong output from legal program
           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=15918



More information about the Gcc-bugs mailing list