Browse Source

--- Merging r30032 into '.':
U compiler/aarch64/ncpumat.pas
--- Merging r30034 into '.':
U compiler/aarch64/ncpuadd.pas
--- Merging r30165 into '.':
U packages/iosxlocale/src/iosxwstr.pp
--- Merging r30229 into '.':
U compiler/aarch64/cpupara.pas
A tests/webtbs/tw27665.pp

# revisions: 30032,30034,30165,30229

git-svn-id: branches/fixes_3_0_ios@30251 -

Jonas Maebe 10 years ago
parent
commit
e090a18663

+ 1 - 0
.gitattributes

@@ -14250,6 +14250,7 @@ tests/webtbs/tw2739.pp svneol=native#text/plain
 tests/webtbs/tw2758.pp svneol=native#text/plain
 tests/webtbs/tw2763.pp svneol=native#text/plain
 tests/webtbs/tw2765.pp svneol=native#text/plain
+tests/webtbs/tw27665.pp svneol=native#text/plain
 tests/webtbs/tw2767.pp svneol=native#text/plain
 tests/webtbs/tw2771.pp svneol=native#text/plain
 tests/webtbs/tw2772.pp svneol=native#text/plain

+ 1 - 0
compiler/aarch64/cpupara.pas

@@ -164,6 +164,7 @@ unit cpupara;
         result:=
           result and
           (elecount>0) and
+          (elecount<=4) and
           (p.size=basedef.size*elecount)
       end;
 

+ 4 - 0
compiler/aarch64/ncpuadd.pas

@@ -366,6 +366,10 @@ interface
                       not(is_signed(right.resultdef));
             pass_left_right;
             force_reg_left_right(true,true);
+            { force_reg_left_right can leave right as a LOC_CONSTANT (we can't
+              say "a constant register is okay, but an ordinal constant isn't) }
+            if right.location.loc=LOC_CONSTANT then
+              hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
             location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
             location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resultdef));
             current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg_reg(multops[unsigned],location.register,left.location.register,right.location.register));

+ 9 - 0
compiler/aarch64/ncpumat.pas

@@ -30,6 +30,7 @@ interface
 
     type
       taarch64moddivnode = class(tmoddivnode)
+         function pass_1: tnode; override;
          procedure pass_generate_code;override;
       end;
 
@@ -58,6 +59,14 @@ implementation
                              taarch64moddivnode
 *****************************************************************************}
 
+    function taarch64moddivnode.pass_1: tnode;
+      begin
+        result:=inherited pass_1;
+        if not assigned(result) then
+          include(current_procinfo.flags,pi_do_call);
+      end;
+
+
     procedure taarch64moddivnode.pass_generate_code;
       var
          op         : tasmop;

+ 1 - 1
packages/iosxlocale/src/iosxwstr.pp

@@ -237,7 +237,7 @@ implementation
       mstr:=CFStringCreateMutableCopy(nil,0,str);
       { lowercase }
       locale:=CFLocaleCopyCurrent;
-      CFStringLowercase(mstr,CFLocaleCopyCurrent);
+      CFStringLowercase(mstr,locale);
       CFRelease(locale);
       { extract the data again }
       range.location:=0;

+ 27 - 0
tests/webtbs/tw27665.pp

@@ -0,0 +1,27 @@
+{$mode objfpc}
+
+      function UTF8CodePointLength(firstbyte: byte): SizeInt;
+      var
+        firstzerobit: SizeInt;
+      begin
+        result:=1;
+        { bsr searches for the leftmost 1 bit. We are interested in the
+          leftmost 0 bit, so first invert the value
+        }
+        firstzerobit:=BsrByte(not(firstbyte));
+        { if there is no zero bit or the first zero bit is the rightmost bit
+          (bit 0), this is an invalid UTF-8 byte ($ff cannot appear in an
+          UTF-8-encoded string, and in the worst case bit 1 has to be zero)
+        }
+        if (firstzerobit=0) or (firstzerobit=255)  then
+          exit;
+        { the number of bytes belonging to this code point is
+          7-(pos first 0-bit).
+        }
+        result:=7-firstzerobit;
+      end;
+
+
+begin
+  writeln(UTF8CodePointLength(ord(' ')));
+end.