fpc/tests/webtbs/tw26993a.pp
Jonas Maebe 6712954607 * correctly handle X86_64_X87UP_CLASS getting merged with another class and
becoming X86_64_SSE_CLASS/X86_64_INTEGER_CLASS/... This is not defined in
    the ABI because there sizeof(extended)=16 and hence the class of the upper
    eightbyte of the extended value can never be merged with the class of
    another field (except in a union, but then the class of the lower
    eightbyte will also be overwritten).

    Handle it the same as when the lower eightbyte class of an extended in an
    aggregate gets changed into something else: pass everything in memory
    (part of mantis #26993)

git-svn-id: trunk@28984 -
2014-11-04 21:16:24 +00:00

51 lines
847 B
ObjectPascal

program tw26993a;
{$mode delphi}
uses
Classes, SysUtils;
type
{ TExtendedTestCase }
TExtendedTestCase = record
private
FValue: extended;
dummy: array[0..5] of byte;
public
property Value: extended read FValue write FValue;
class operator Add(v1, v2: TExtendedTestCase): TExtendedTestCase;
class operator Multiply(v1, v2: TExtendedTestCase): TExtendedTestCase;
end;
{ TExtendedTestCase }
class operator TExtendedTestCase.Add(v1, v2: TExtendedTestCase): TExtendedTestCase;
begin
Result.Value := v1.Value + v2.Value;
end;
class operator TExtendedTestCase.Multiply(v1, v2: TExtendedTestCase):
TExtendedTestCase;
begin
Result.Value := v1.Value * v2.Value;
end;
var
e1,e2,e3: textendedtestcase;
begin
e1.fvalue:=2.0;
e2.fvalue:=3.0;
e3:=e1+e2;
if (e3*e2).fvalue<>15.0 then
halt(1);
end.