Merged revisions 39 via svnmerge from

/trunk

git-svn-id: branches/fixes_2_0@49 -
This commit is contained in:
fpc 2005-05-21 14:51:11 +00:00
parent b409904e44
commit c25b4742d1
3 changed files with 76 additions and 3 deletions

1
.gitattributes vendored
View File

@ -6132,6 +6132,7 @@ tests/webtbs/tw3900.pp svneol=native#text/plain
tests/webtbs/tw3953a.pp svneol=native#text/plain
tests/webtbs/tw3953b.pp svneol=native#text/plain
tests/webtbs/tw3967.pp svneol=native#text/plain
tests/webtbs/tw3971.pp svneol=native#text/plain
tests/webtbs/tw3973.pp svneol=native#text/plain
tests/webtbs/tw3977.pp svneol=native#text/plain
tests/webtbs/tw3977.txt svneol=native#text/plain

View File

@ -3091,10 +3091,12 @@ implementation
function tarraydef.alignment : longint;
begin
{ alignment is the size of the elements }
if elementtype.def.deftype=recorddef then
alignment:=elementtype.def.alignment
if (elementtype.def.deftype in [arraydef,recorddef]) or
((elementtype.def.deftype=objectdef) and
is_object(elementtype.def)) then
alignment:=elementtype.def.alignment
else
alignment:=elesize;
alignment:=elesize;
end;

70
tests/webtbs/tw3971.pp Normal file
View File

@ -0,0 +1,70 @@
{ Source provided for Free Pascal Bug Report 3971 }
{ Submitted by "Thomas Schatzl" on 2005-05-16 }
{ e-mail: }
type
TDemo1 = object
member1 : byte;
member2 : longint;
member7 : ^longint;
member3 : int64;
member4 : byte;
member5 : longint;
//x : boolean;
//
member6 : int64;
x : boolean;
end;
TDemo = object
constructor init;
destructor Destroy;
procedure doSomething;
procedure doSomething2;
member1 : byte;
member5 : longint;
member6 : int64;
y : array[0..2] of TDemo1;
end;
var
x : array[0..2] of TDemo;
z : TDemo;
w : TDemo1;
constructor TDemo.init();
begin
WriteLn('Create start');
inherited;
WriteLn('Create end');
end;
destructor TDemo.Destroy();
begin
WriteLn('Destroy start');
inherited;
WriteLn('Destroy end');
end;
procedure TDemo.doSomething;
begin
WriteLn('doSomething');
end;
procedure TDemo.doSomething2;
begin
WriteLn('doSomething');
end;
begin
z.init;
if ((ptrint(@z.y)-ptrint(@z)) mod sizeof(ptrint))<>0 then
halt(1);
if ((ptrint(@z.y[0].member7)-ptrint(@z)) mod sizeof(ptrint))<>0 then
halt(1);
z.destroy;
WriteLn(sizeof(TDemo), ' ', sizeof(TDemo1));
end.