mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-08 09:58:40 +02:00
* ensure that changed compiler options do not cause values
ending up in registers which cannot be hold in registers git-svn-id: trunk@47415 -
This commit is contained in:
parent
8bbd92bf82
commit
089e13396a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -18529,6 +18529,7 @@ tests/webtbs/tw38022.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw3805.pp svneol=native#text/plain
|
tests/webtbs/tw3805.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw38051.pp svneol=native#text/pascal
|
tests/webtbs/tw38051.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38054.pp svneol=native#text/plain
|
tests/webtbs/tw38054.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw38069.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38074.pp svneol=native#text/pascal
|
tests/webtbs/tw38074.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3814.pp svneol=native#text/plain
|
tests/webtbs/tw3814.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3827.pp svneol=native#text/plain
|
tests/webtbs/tw3827.pp svneol=native#text/plain
|
||||||
@ -19069,6 +19070,7 @@ tests/webtbs/uw35918a.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/uw35918b.pp svneol=native#text/pascal
|
tests/webtbs/uw35918b.pp svneol=native#text/pascal
|
||||||
tests/webtbs/uw35918c.pp svneol=native#text/pascal
|
tests/webtbs/uw35918c.pp svneol=native#text/pascal
|
||||||
tests/webtbs/uw36544.pp svneol=native#text/pascal
|
tests/webtbs/uw36544.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/uw38069.pp svneol=native#text/pascal
|
||||||
tests/webtbs/uw3968.pp svneol=native#text/plain
|
tests/webtbs/uw3968.pp svneol=native#text/plain
|
||||||
tests/webtbs/uw4056.pp svneol=native#text/plain
|
tests/webtbs/uw4056.pp svneol=native#text/plain
|
||||||
tests/webtbs/uw4140.pp svneol=native#text/plain
|
tests/webtbs/uw4140.pp svneol=native#text/plain
|
||||||
|
@ -1381,6 +1381,12 @@ implementation
|
|||||||
if assigned(tempinfo^.tempinitcode) then
|
if assigned(tempinfo^.tempinitcode) then
|
||||||
firstpass(tempinfo^.tempinitcode);
|
firstpass(tempinfo^.tempinitcode);
|
||||||
inc(current_procinfo.estimatedtempsize,size);
|
inc(current_procinfo.estimatedtempsize,size);
|
||||||
|
{ if a temp. create node is loaded from a ppu, it could be that the unit was compiled with other settings which
|
||||||
|
enabled a certain type to be stored in a register while the current settings do not support this, so correct this here
|
||||||
|
if needed
|
||||||
|
}
|
||||||
|
if not(tstoreddef(tempinfo^.typedef).is_fpuregable) and not(tstoreddef(tempinfo^.typedef).is_intregable) and (ti_may_be_in_reg in tempflags) then
|
||||||
|
excludetempflag(ti_may_be_in_reg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
12
tests/webtbs/tw38069.pp
Normal file
12
tests/webtbs/tw38069.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{ %cpu=i386 }
|
||||||
|
{$mode objfpc}
|
||||||
|
{$OPTIMIZATION REGVAR}
|
||||||
|
{.$FPUTYPE SSE2} //uncommenting this resolves the problem
|
||||||
|
|
||||||
|
uses uw38069;
|
||||||
|
|
||||||
|
var z: complex;
|
||||||
|
n: integer;
|
||||||
|
begin
|
||||||
|
z := z*n; //internal error 200604201
|
||||||
|
end.
|
96
tests/webtbs/uw38069.pp
Normal file
96
tests/webtbs/uw38069.pp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
{ %cpu=i386 }
|
||||||
|
{$mode objfpc}
|
||||||
|
{$modeswitch advancedrecords}
|
||||||
|
{$FPUTYPE SSE2}
|
||||||
|
|
||||||
|
unit uw38069;
|
||||||
|
INTERFACE
|
||||||
|
uses sysutils;
|
||||||
|
type float = double; //#zentral definieren
|
||||||
|
complex = record
|
||||||
|
public
|
||||||
|
re, im: float;
|
||||||
|
class operator * (const a, b: complex): complex; inline;
|
||||||
|
class operator * (const a: complex; const x:float): complex; inline;
|
||||||
|
class operator * (const x: float; const a: complex): complex; inline;
|
||||||
|
|
||||||
|
class operator := (const x: float): complex; inline;
|
||||||
|
class operator = (const a,b: complex): boolean; inline;
|
||||||
|
class operator - (const a: complex): complex; inline;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure mul (const a,b: complex; var c: complex); inline; overload;
|
||||||
|
procedure mul (const a: complex; const b: float; var c: complex); inline; overload;
|
||||||
|
procedure mul (const a: float; const b: complex; var c: complex); inline; overload;
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENTATION
|
||||||
|
|
||||||
|
|
||||||
|
procedure mul (const a,b: complex; var c: complex);
|
||||||
|
begin
|
||||||
|
c.re := a.re*b.re - a.im*b.im;
|
||||||
|
c.im := a.re*b.im + a.im*b.re;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure mul (const a: complex; const b: float; var c: complex);
|
||||||
|
begin
|
||||||
|
c.re := a.re*b;
|
||||||
|
c.im := a.im*b;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure mul (const a: float; const b: complex; var c: complex);
|
||||||
|
begin
|
||||||
|
mul (b,a,c);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function pow (x,y: float): float;
|
||||||
|
begin
|
||||||
|
result := exp (y*ln(x));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function ToComplex (a,b: float): complex;
|
||||||
|
begin
|
||||||
|
result.re := a;
|
||||||
|
result.im := b;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//Operatoren complex-complex
|
||||||
|
class operator complex.* (const a,b: complex): complex;
|
||||||
|
begin
|
||||||
|
mul (a,b,result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator complex.* (const x: float; const a: complex): complex;
|
||||||
|
begin
|
||||||
|
mul (a,x,result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator complex.* (const a: complex; const x:float): complex;
|
||||||
|
begin
|
||||||
|
mul (a,x,result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator complex.:= (const x: float): complex;
|
||||||
|
begin
|
||||||
|
result.re := x;
|
||||||
|
result.im := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator complex.= (const a,b: complex): boolean;
|
||||||
|
begin
|
||||||
|
result := (a.re=b.re) and (a.im=b.im);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator complex.- (const a: complex): complex;
|
||||||
|
begin
|
||||||
|
result.re := -a.re;
|
||||||
|
result.im := -a.im;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user