fpc/tests/tbs/tb0573.pp
Jonas Maebe ea4bb9d752 * don't treat variant records with one element as "records with one element"
(the ABIs that prescribe special treatment for aggregates with one
     scalar element don't either, since a "union containing a single scalar"
     is not the same as a scalar)
  * fixed passing record with a single float field on PowerPC/AIX abi's
  * several changes to cgobj and ncgutil to correctly deal with transfering
    such records between integer and floating point registers

git-svn-id: trunk@15416 -
2010-06-13 09:57:58 +00:00

47 lines
488 B
ObjectPascal

{$mode objfpc}
type
tr1 = record
s: single;
end;
tr2 = record
case byte of
1: (s: single);
end;
function f1(r1:tr1): tr1;
var
s: single;
begin
s:=r1.s;
result.s:=s;
end;
function f2(r2:tr2): tr2;
var
s: single;
begin
s:=r2.s;
result.s:=s;
end;
procedure test;
var
r1,r1a: tr1;
r2,r2a: tr2;
begin
r1.s:=1.0;
r2.s:=2.0;
r1a:=f1(r1);
r2a:=f2(r2);
if r1a.s<>1.0 then
halt(1);
if r2a.s<>2.0 then
halt(1);
end;
begin
test;
end.