Test suite results for test file test/cg/tobjsize.pp

Test run data :

Free Pascal Compiler Test Suite Results

View Test suite results

Please specify search criteria:
File:
Operating system:
Processor:
Version
Date
Submitter
Machine
Comment
Limit
Cond
Category
Only failed tests
Hide skipped tests
List all tests

Test file "test/cg/tobjsize.pp" information:

t_id 194
t_adddate 2003/10/03
t_result 0
t_knownrunerror 0

Detailed test run results:

Record count: 50

Total = 50

OK=50 Percentage= 100.00

Result type Cat. Count Percentage First date Last Date
Successfully run 50 100.0 2024/05/17 11:04:00 38 2024/05/17 16:28:00 32
i386 10 20.0 2024/05/17 11:29:00 44 2024/05/17 12:24:00 45
sparc 1 2.0 2024/05/17 12:01:00 74 2024/05/17 12:01:00 74
powerpc 1 2.0 2024/05/17 11:30:00 242 2024/05/17 11:30:00 242
x86_64 26 52.0 2024/05/17 11:10:00 26 2024/05/17 14:42:00 39
powerpc64 2 4.0 2024/05/17 11:34:00 242 2024/05/17 11:39:00 59
mips 1 2.0 2024/05/17 11:21:00 241 2024/05/17 11:21:00 241
aarch64 7 14.0 2024/05/17 11:04:00 38 2024/05/17 16:28:00 32
sparc64 1 2.0 2024/05/17 12:19:00 173 2024/05/17 12:19:00 173
riscv64 1 2.0 2024/05/17 11:56:00 31 2024/05/17 11:56:00 31
linux 35 70.0 2024/05/17 11:04:00 38 2024/05/17 12:48:00 22
solaris 10 20.0 2024/05/17 11:29:00 44 2024/05/17 12:24:00 45
darwin 3 6.0 2024/05/17 16:15:00 32 2024/05/17 16:28:00 32
win64 2 4.0 2024/05/17 13:34:00 47 2024/05/17 14:42:00 39
3.3.1 19 38.0 2024/05/17 11:10:00 26 2024/05/17 14:42:00 39
3.2.2 10 20.0 2024/05/17 11:29:00 44 2024/05/17 12:24:00 45
3.2.3 21 42.0 2024/05/17 11:04:00 38 2024/05/17 16:28:00 32

Source:


{$static on}

type
   pbaseclass = ^tbaseclass;
   pderivedclass = ^tderivedclass;

   tbaseclass = object
     x : longint;
     constructor init;
     function getsize : longint; static;
     function getsize2 : longint;
     procedure check_size; virtual;
     procedure static_check_size; static;
     procedure check_normal;
     procedure check_static; static;
     procedure check_virtual; virtual;
     destructor done; virtual;
   end;

   tderivedclass = object(tbaseclass)
     y : longint;
     procedure check_size; virtual;
   end;

const
  has_error : boolean = false;
  expected_size_for_tbaseclass = sizeof(pointer) + sizeof(longint);
  expected_size_for_tderivedclass = sizeof(pointer) + 2*sizeof(longint);

var
  basesize : longint;
  derivedsize : longint;

constructor tbaseclass.init;
begin
end;

destructor tbaseclass.done;
begin
end;

function tbaseclass.getsize : longint;
begin
  getsize:=sizeof(self);
end;

function tbaseclass.getsize2 : longint;
begin
  getsize2:=sizeof(self);
end;

procedure tbaseclass.check_size;
begin
  if sizeof(self)<>getsize then
    begin
      Writeln('Compiler creates garbage');
      has_error:=true;
    end;
  if sizeof(self)<>getsize2 then
    begin
      Writeln('Compiler creates garbage');
      has_error:=true;
    end;
end;

procedure tbaseclass.static_check_size;
begin
  if sizeof(self)<>getsize then
    begin
      Writeln('Compiler creates garbage');
      has_error:=true;
    end;
end;

procedure tbaseclass.check_normal;
begin
  check_size;
  static_check_size;
end;

procedure tbaseclass.check_static;
begin
  {check_size;}
  static_check_size;
end;

procedure tbaseclass.check_virtual;
begin
  check_size;
  static_check_size;
end;


procedure tderivedclass.check_size;

begin
  Writeln('Calling tderived check_size method');
  inherited check_size;
end;

var
  cb : tbaseclass;
  cd : tderivedclass;
  c1 : pbaseclass;
begin
 cb.init;
 cd.init;
 new(c1,init);

 basesize:=sizeof(cb);
 Writeln('Sizeof(cb)=',basesize);
 if basesize<>expected_size_for_tbaseclass then
   Writeln('not the expected size : ',expected_size_for_tbaseclass);

 derivedsize:=sizeof(cd);
 Writeln('Sizeof(ct)=',derivedsize);
 if derivedsize<>expected_size_for_tderivedclass then
   Writeln('not the expected size : ',expected_size_for_tderivedclass);

 cb.check_size;
 cd.check_size;
 c1^.check_size;
 cb.static_check_size;
 cd.static_check_size;
 c1^.static_check_size;
 tbaseclass.static_check_size;
 tderivedclass.static_check_size;
 tbaseclass.check_static;
 tderivedclass.check_static;

 cb.check_normal;
 cb.check_static;
 cb.check_virtual;
 cd.check_normal;
 cd.check_static;
 cd.check_virtual;

 dispose (c1,done);

 c1:=new(pderivedclass,init);
 c1^.check_size;
 c1^.static_check_size;
 dispose (c1,done);

 if has_error then
   begin
     Writeln('Error with class methods');
     halt(1);
   end;

end.

Link to SVN view of test/cg/tobjsize.pp source.