mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 00:08:17 +02:00

(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 -
47 lines
488 B
ObjectPascal
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.
|