summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw10454.pp
blob: 77bdbfdef47fe6f3da2efd123a58ff401c75ccc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{$mode objfpc}

type
  TMyObject = object
    Int: longint;
  end;

  TMyObject2 = object(TMyObject)
  end;

  TMyClass = class
    FByte: byte;
    Obj: TMyObject2;  // instance of this object is not aligned
  end;

var
  myclass: TMyClass;
begin
  myclass:=TMyClass.Create;
  myclass.obj.int:=1; // Crash due to unaligned data access
  myclass.Free;
end.