Pārlūkot izejas kodu

Merged revisions 7975,7977,7980 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r7975 | yury | 2007-07-07 20:37:34 +0300 (Сб, 07 июл 2007) | 2 lines

* Fixed bug #9221.
+ Test.
........
r7977 | yury | 2007-07-07 22:19:49 +0300 (Сб, 07 июл 2007) | 1 line

* Fixed float constants in softfloat mode when compiler was compiled in hardfloat mode on arm-linux host.
........
r7980 | yury | 2007-07-08 11:17:32 +0300 (Вс, 08 июл 2007) | 1 line

* Fixed Abs and Sqrt in hardfloat mode on arm.
........

git-svn-id: branches/fixes_2_2@7986 -

yury 18 gadi atpakaļ
vecāks
revīzija
bf4d4997b4

+ 1 - 0
.gitattributes

@@ -8152,6 +8152,7 @@ tests/webtbs/tw9179.pp svneol=native#text/plain
 tests/webtbs/tw9187.pp svneol=native#text/plain
 tests/webtbs/tw9190.pp svneol=native#text/plain
 tests/webtbs/tw9209.pp svneol=native#text/plain
+tests/webtbs/tw9221.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 0 - 3
compiler/aggas.pas

@@ -775,8 +775,6 @@ implementation
                  swap64bitarray(t64bitarray(d));
                AsmWrite(#9'.byte'#9);
 {$ifdef arm}
-{ on a real arm cpu, it's already hi/lo swapped }
-{$ifndef cpuarm}
                if tai_real_64bit(hp).formatoptions=fo_hiloswapped then
                  begin
                    for i:=4 to 7 do
@@ -792,7 +790,6 @@ implementation
                      end;
                  end
                else
-{$endif cpuarm}
 {$endif arm}
                  begin
                    for i:=0 to 7 do

+ 3 - 0
compiler/arm/narmcon.pas

@@ -68,6 +68,9 @@ interface
         realait:=floattype2ait[tfloatdef(resultdef).floattype];
         hiloswapped:=(current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
           not(cs_fp_emulation in current_settings.moduleswitches);;
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+        hiloswapped:=not hiloswapped;
+{$endif FPC_DOUBLE_HILO_SWAPPED}
         { const already used ? }
         if not assigned(lab_real) then
           begin

+ 6 - 6
compiler/arm/narminl.pas

@@ -167,7 +167,7 @@ implementation
     procedure tarminlinenode.second_abs_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,location.register),get_fpu_postfix(resultdef)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
 
 
@@ -181,7 +181,7 @@ implementation
     procedure tarminlinenode.second_sqrt_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,location.register),get_fpu_postfix(resultdef)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
 
 
@@ -189,27 +189,27 @@ implementation
     procedure tarminlinenode.second_arctan_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ATN,location.register,location.register),get_fpu_postfix(resultdef)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ATN,location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
 
 
     procedure tarminlinenode.second_ln_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_LGN,location.register,location.register),get_fpu_postfix(resultdef)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_LGN,location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
 
     procedure tarminlinenode.second_cos_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_COS,location.register,location.register),get_fpu_postfix(resultdef)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_COS,location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
 
 
     procedure tarminlinenode.second_sin_real;
       begin
         load_fpu_location;
-        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SIN,location.register,location.register),get_fpu_postfix(resultdef)));
+        current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SIN,location.register,left.location.register),get_fpu_postfix(resultdef)));
       end;
     }
 

+ 0 - 3
compiler/i386/ag386nsm.pas

@@ -661,8 +661,6 @@ interface
                  swap64bitarray(t64bitarray(d));
                AsmWrite(#9#9'DB'#9);
 {$ifdef arm}
-{ on a real arm cpu, it's already hi/lo swapped }
-{$ifndef cpuarm}
                if tai_real_64bit(hp).formatoptions=fo_hiloswapped then
                  begin
                    for i:=4 to 7 do
@@ -678,7 +676,6 @@ interface
                      end;
                  end
                else
-{$endif cpuarm}
 {$endif arm}
                  begin
                    for i:=0 to 7 do

+ 3 - 0
compiler/ncgcon.pas

@@ -124,6 +124,9 @@ implementation
 {$ifdef ARM}
         hiloswapped:=(current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) and
           not(cs_fp_emulation in current_settings.moduleswitches);
+{$ifdef FPC_DOUBLE_HILO_SWAPPED}
+        hiloswapped:=not hiloswapped;
+{$endif FPC_DOUBLE_HILO_SWAPPED}
 {$endif ARM}
         { const already used ? }
         if not assigned(lab_real) then

+ 4 - 3
rtl/inc/wstrings.inc

@@ -984,9 +984,10 @@ begin
         end;
       { Force nil termination in case it gets shorter }
       PWord(Pointer(S)+l*sizeof(WideChar))^:=0;
-{$ifndef FPC_WINLIKEWIDESTRING}
-      PWideRec(Pointer(S)-WideFirstOff)^.Len:=l*sizeof(WideChar);
-{$endif FPC_WINLIKEWIDESTRING}
+{$ifdef MSWINDOWS}
+      if not winwidestringalloc then
+{$endif MSWINDOWS}
+        PWideRec(Pointer(S)-WideFirstOff)^.Len:=l*sizeof(WideChar);
     end
   else
     begin

+ 13 - 0
tests/webtbs/tw9221.pp

@@ -0,0 +1,13 @@
+{%target=win32,win64}
+
+var
+  s: widestring;
+begin
+  winwidestringalloc:=false;
+  s:='1234';
+  SetLength(s, 10);
+  if Length(s) <> 10 then begin
+    writeln('Test failed!');
+    Halt(1);
+  end;
+end.