summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-11-15 14:15:06 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-11-15 14:15:06 +0000
commit7e22d723d934970f020ce7c1f306d9a6da881e54 (patch)
treef16c263d679a991f8adc163441c28cc57acb1066
parentf41a22caa1efb9b91417876e0ac4a281c29a7d76 (diff)
downloadfpc-7e22d723d934970f020ce7c1f306d9a6da881e54.tar.gz
-- Zusammenführen von r47415 in ».«:
U compiler/nbas.pas A tests/webtbs/tw38069.pp A tests/webtbs/uw38069.pp -- Aufzeichnung der Informationen für Zusammenführung von r47415 in ».«: U . git-svn-id: https://svn.freepascal.org/svn/fpc/branches/fixes_3_2@47422 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/nbas.pas6
-rw-r--r--tests/webtbs/tw38069.pp12
-rw-r--r--tests/webtbs/uw38069.pp96
3 files changed, 114 insertions, 0 deletions
diff --git a/compiler/nbas.pas b/compiler/nbas.pas
index 1e9ab45043..f2803b938e 100644
--- a/compiler/nbas.pas
+++ b/compiler/nbas.pas
@@ -1067,6 +1067,12 @@ implementation
if assigned(tempinfo^.tempinitcode) then
firstpass(tempinfo^.tempinitcode);
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;
diff --git a/tests/webtbs/tw38069.pp b/tests/webtbs/tw38069.pp
new file mode 100644
index 0000000000..6ccf3468a8
--- /dev/null
+++ b/tests/webtbs/tw38069.pp
@@ -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.
diff --git a/tests/webtbs/uw38069.pp b/tests/webtbs/uw38069.pp
new file mode 100644
index 0000000000..7ecc742b46
--- /dev/null
+++ b/tests/webtbs/uw38069.pp
@@ -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.