Browse Source

* synchronized with trunk

git-svn-id: branches/unicodekvm@48529 -
nickysn 4 years ago
parent
commit
56f10ae916

+ 3 - 0
.gitattributes

@@ -16603,6 +16603,7 @@ tests/webtbf/tw2414.pp svneol=native#text/plain
 tests/webtbf/tw24184.pp svneol=native#text/plain
 tests/webtbf/tw24428.pp svneol=native#text/plain
 tests/webtbf/tw24428a.pp svneol=native#text/plain
+tests/webtbf/tw24434.pp svneol=native#text/pascal
 tests/webtbf/tw24453.pp svneol=native#text/pascal
 tests/webtbf/tw24495.pp svneol=native#text/pascal
 tests/webtbf/tw24588.pp svneol=native#text/pascal
@@ -18343,6 +18344,7 @@ tests/webtbs/tw32111.pp svneol=native#text/pascal
 tests/webtbs/tw32115.pp svneol=native#text/pascal
 tests/webtbs/tw32118.pp svneol=native#text/pascal
 tests/webtbs/tw3212.pp svneol=native#text/plain
+tests/webtbs/tw32139.pp -text svneol=native#text/pascal
 tests/webtbs/tw3214.pp svneol=native#text/plain
 tests/webtbs/tw32150.pp svneol=native#text/pascal
 tests/webtbs/tw3216.pp svneol=native#text/plain
@@ -18439,6 +18441,7 @@ tests/webtbs/tw33898.pp -text svneol=native#text/pascal
 tests/webtbs/tw33963.pp svneol=native#text/pascal
 tests/webtbs/tw3402.pp svneol=native#text/plain
 tests/webtbs/tw34021.pp -text svneol=native#text/pascal
+tests/webtbs/tw34027.pp svneol=native#text/pascal
 tests/webtbs/tw34037.pp svneol=native#text/pascal
 tests/webtbs/tw34055.pp svneol=native#text/plain
 tests/webtbs/tw3411.pp svneol=native#text/plain

+ 21 - 1
compiler/Makefile

@@ -4640,6 +4640,9 @@ ifdef CMP
 override DIFF:=$(CMP) -i218
 endif
 endif
+ifeq ($(OS_TARGET), darwin)
+CODESIGN?=$(strip $(wildcard $(addsuffix /codesign,$(SEARCHPATH))))
+endif
 ifneq ($(CYCLELEVEL),1)
 ifndef ALLOW_WARNINGS
 override LOCALOPT+=-Sew
@@ -4941,7 +4944,11 @@ ifdef OLDFPC
 ifneq ($(OS_TARGET),darwin)
 DIFFRESULT:=$(shell $(DIFF) $(OLDFPC) $(FPC))
 else
-DIFFRESULT:=$(shell cp $(OLDFPC) $(OLDFPC).tmp; cp $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; rm $(OLDFPC).tmp $(FPC).tmp)
+ifneq ($(CODESIGN),)
+DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(CODESIGN) --remove-signature $(OLDFPC).tmp; codesign --remove-signature $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)
+else
+DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)
+endif
 endif
 else
 DIFFRESULT=Not equal
@@ -4980,7 +4987,20 @@ endif
 	$(MAKE) tempclean
 	$(MAKE) $(TEMPNAME3)
 	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3PREFIX)$(TEMPNAME3)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME2)' next CYCLELEVEL=4
+ifneq ($(OS_TARGET), darwin)
 	$(DIFF) $(TEMPNAME3) $(EXENAME)
+else
+	$(COPY) $(TEMPNAME3) $(TEMPNAME3).tmp
+	$(COPY) $(EXENAME) $(EXENAME).tmp
+	strip -no_uuid $(TEMPNAME3).tmp
+	strip -no_uuid $(EXENAME).tmp
+ifneq ($(CODESIGN),)
+	$(CODESIGN) --remove-signature $(TEMPNAME3).tmp
+	$(CODESIGN) --remove-signature $(EXENAME).tmp
+endif
+	$(DIFF) $(TEMPNAME3).tmp $(EXENAME).tmp
+	rm $(TEMPNAME3).tmp $(EXENAME).tmp
+endif
 	$(MAKE) $(addsuffix _all,$(TARGET_DIRS)) 'FPC=$(BASEDIR)/$(EXENAMEPREFIX)$(EXENAME)'
 	$(MAKE) wpocycle
 	$(MAKE) echotime

+ 22 - 1
compiler/Makefile.fpc

@@ -438,6 +438,10 @@ override DIFF:=$(CMP) -i218
 endif
 endif
 
+ifeq ($(OS_TARGET), darwin)
+CODESIGN?=$(strip $(wildcard $(addsuffix /codesign,$(SEARCHPATH))))
+endif
+
 # Use -Sew option by default
 # Allow disabling by setting ALLOW_WARNINGS=1
 ifneq ($(CYCLELEVEL),1)
@@ -878,7 +882,11 @@ ifdef OLDFPC
 ifneq ($(OS_TARGET),darwin)
 DIFFRESULT:=$(shell $(DIFF) $(OLDFPC) $(FPC))
 else
-DIFFRESULT:=$(shell cp $(OLDFPC) $(OLDFPC).tmp; cp $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; rm $(OLDFPC).tmp $(FPC).tmp)
+ifneq ($(CODESIGN),)
+DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(CODESIGN) --remove-signature $(OLDFPC).tmp; codesign --remove-signature $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)
+else
+DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)
+endif
 endif
 else
 DIFFRESULT=Not equal
@@ -922,7 +930,20 @@ endif
         $(MAKE) tempclean
         $(MAKE) $(TEMPNAME3)
         $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3PREFIX)$(TEMPNAME3)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME2)' next CYCLELEVEL=4
+ifneq ($(OS_TARGET), darwin)
         $(DIFF) $(TEMPNAME3) $(EXENAME)
+else
+        $(COPY) $(TEMPNAME3) $(TEMPNAME3).tmp
+        $(COPY) $(EXENAME) $(EXENAME).tmp
+        strip -no_uuid $(TEMPNAME3).tmp
+        strip -no_uuid $(EXENAME).tmp
+ifneq ($(CODESIGN),)
+        $(CODESIGN) --remove-signature $(TEMPNAME3).tmp
+        $(CODESIGN) --remove-signature $(EXENAME).tmp
+endif
+        $(DIFF) $(TEMPNAME3).tmp $(EXENAME).tmp
+        rm $(TEMPNAME3).tmp $(EXENAME).tmp
+endif
         $(MAKE) $(addsuffix _all,$(TARGET_DIRS)) 'FPC=$(BASEDIR)/$(EXENAMEPREFIX)$(EXENAME)'
         $(MAKE) wpocycle
         $(MAKE) echotime

+ 16 - 0
compiler/aasmcnst.pas

@@ -427,6 +427,10 @@ type
      function queue_subscriptn_multiple_by_name(def: tabstractrecorddef; const fields: array of TIDString): tdef;
      { queue a type conversion operation }
      procedure queue_typeconvn(fromdef, todef: tdef); virtual;
+     { queue a add operation }
+     procedure queue_addn(def: tdef; const index: tconstexprint); virtual;
+     { queue a sub operation }
+     procedure queue_subn(def: tdef; const index: tconstexprint); virtual;
      { finalise the queue (so a new one can be created) and flush the
         previously queued operations, applying them in reverse order on a...}
      { ... procdef }
@@ -2080,6 +2084,18 @@ implementation
      end;
 
 
+   procedure ttai_typedconstbuilder.queue_addn(def: tdef; const index: tconstexprint);
+     begin
+       inc(fqueue_offset,def.size*int64(index));
+     end;
+
+
+   procedure ttai_typedconstbuilder.queue_subn(def: tdef; const index: tconstexprint);
+     begin
+       dec(fqueue_offset,def.size*int64(index));
+     end;
+
+
    procedure ttai_typedconstbuilder.queue_subscriptn(def: tabstractrecorddef; vs: tfieldvarsym);
      begin
        inc(fqueue_offset,vs.fieldoffset);

+ 2 - 1
compiler/cfidwarf.pas

@@ -435,7 +435,8 @@ implementation
                     end
                   else
                     begin
-                      tc:=tai_const.create_sym(cielabel);
+                      { according to the dwarf (2 to 4) standard, this is an uword being always 32 bit unsigned }
+                      tc:=tai_const.create_type_sym(aitconst_32bit,cielabel);
                       { force label offset to secrel32 for windows systems }
                       if (target_info.system in systems_windows+systems_wince) then
                         tc.consttype:=aitconst_secrel32_symbol;

+ 10 - 6
compiler/m68k/ag68kgas.pas

@@ -169,7 +169,7 @@ interface
       end;
 
 
-    function getopstr(var o:toper) : string;
+    function getopstr(size: topsize; var o:toper) : string;
       var
         i : tsuperregister;
       begin
@@ -220,10 +220,14 @@ interface
             getopstr:='#'+tostr(longint(o.val));
           top_realconst:
             begin
-              str(o.val_real,getopstr);
-              if getopstr[1]=' ' then
-                getopstr[1]:='+';
-              getopstr:='#0d'+getopstr;
+              case size of
+                S_FS:
+                  getopstr:='#0x'+hexstr(longint(single(o.val_real)),sizeof(single)*2);
+                S_FD:
+                  getopstr:='#0x'+hexstr(BestRealRec(o.val_real).Data,sizeof(bestreal)*2);
+              else
+                internalerror(2021020801);
+              end;
             end;
           else internalerror(200405021);
         end;
@@ -337,7 +341,7 @@ interface
                         sep:=':'
                       else
                         sep:=',';
-                      s:=s+sep+getopstr(taicpu(hp).oper[i]^);
+                      s:=s+sep+getopstr(taicpu(hp).opsize,taicpu(hp).oper[i]^);
                     end;
                 end;
            end;

+ 11 - 9
compiler/m68k/cgcpu.pas

@@ -1068,15 +1068,17 @@ unit cgcpu;
                     list.concat(taicpu.op_reg_reg(A_FMOVE, tcgsize2opsize[tosize], reg1, hreg));
                     list.concat(taicpu.op_reg_reg(A_FMOVE, tcgsize2opsize[tosize], hreg, reg2));
                   end;
+              OS_F64:
+                  begin
+                    //list.concat(tai_comment.create(strpnew('a_loadfpu_reg_reg rounding via stack')));
+                    reference_reset_base(href, NR_STACK_POINTER_REG, 0, ctempposinvalid, 0, []);
+                    href.direction:=dir_dec;
+                    list.concat(taicpu.op_reg_ref(A_FMOVE, tcgsize2opsize[tosize], reg1, href));
+                    href.direction:=dir_inc;
+                    list.concat(taicpu.op_ref_reg(A_FMOVE, tcgsize2opsize[tosize], href, reg2));
+                  end;
             else
-              begin
-                //list.concat(tai_comment.create(strpnew('a_loadfpu_reg_reg rounding via stack')));
-                reference_reset_base(href, NR_STACK_POINTER_REG, 0, ctempposinvalid, 0, []);
-                href.direction:=dir_dec;
-                list.concat(taicpu.op_reg_ref(A_FMOVE, tcgsize2opsize[tosize], reg1, href));
-                href.direction:=dir_inc;
-                list.concat(taicpu.op_ref_reg(A_FMOVE, tcgsize2opsize[tosize], href, reg2));
-              end;
+              internalerror(2021020802);
             end;
           end
         else
@@ -1098,7 +1100,7 @@ unit cgcpu;
         fixref(list,href,current_settings.fputype = fpu_coldfire);
         list.concat(taicpu.op_ref_reg(A_FMOVE,opsize,href,reg));
         if fromsize > tosize then
-          a_load_reg_reg(list,fromsize,tosize,reg,reg);
+          a_loadfpu_reg_reg(list,fromsize,tosize,reg,reg);
       end;
 
     procedure tcg68k.a_loadfpu_reg_ref(list: TAsmList; fromsize,tosize: tcgsize; reg: tregister; const ref: treference);

+ 1 - 1
compiler/m68k/n68kadd.pas

@@ -201,7 +201,7 @@ implementation
             hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
 
             location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
-            cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
+            cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,left.location.size,location.size,left.location.register,location.register);
           end;
 
         { emit the actual operation }

+ 3 - 3
compiler/m68k/n68kinl.pas

@@ -253,7 +253,7 @@ implementation
             //current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqr_real called!: left was cfpuregister!')));
             location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
             location.loc := LOC_FPUREGISTER;
-            cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
+            cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,left.location.size,location.size,left.location.register,location.register);
           end;
         current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FMUL,fpuregopsize,left.location.register,location.register));
       end;
@@ -333,7 +333,7 @@ implementation
             begin
               hreg:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
               location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
-              cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
+              cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,left.location.size,location.size,left.location.register,location.register);
               current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FINTRZ,fpuregopsize,left.location.register,hreg));
               current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSUB,fpuregopsize,hreg,location.register));
             end;
@@ -343,7 +343,7 @@ implementation
               location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
               href:=left.location.reference;
               tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,current_settings.fputype = fpu_coldfire);
-              cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmlist,left.location.size,OS_NO,href,location.register);
+              cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmlist,left.location.size,location.size,href,location.register);
               current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FINTRZ,fpuregopsize,location.register,hreg));
               current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSUB,fpuregopsize,hreg,location.register));
             end;

+ 27 - 5
compiler/ngtcon.pas

@@ -150,7 +150,7 @@ uses
    defutil,defcmp,
    { pass 1 }
    htypechk,procinfo,
-   nmem,ncnv,ninl,ncon,nld,
+   nmem,ncnv,ninl,ncon,nld,nadd,
    { parser specific stuff }
    pbase,pexpr,
    { codegen }
@@ -826,7 +826,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { maybe pchar ? }
         else
           if is_char(def.pointeddef) and
-             (node.nodetype<>addrn) then
+            ((node.nodetype=stringconstn) or is_constcharnode(node)) then
             begin
               { create a tcb for the string data (it's placed in a separate
                 asmlist) }
@@ -875,7 +875,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
         { maybe pwidechar ? }
         else
           if is_widechar(def.pointeddef) and
-             (node.nodetype<>addrn) then
+            (node.nodetype in [stringconstn,ordconstn]) then
             begin
               if (node.nodetype in [stringconstn,ordconstn]) then
                 begin
@@ -912,13 +912,13 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                 Message(parser_e_illegal_expression);
           end
         else
-          if (node.nodetype=addrn) or
+          if (node.nodetype in [addrn,addn,subn]) or
              is_proc2procvar_load(node,pd) then
             begin
               { insert typeconv }
               inserttypeconv(node,def);
               hp:=node;
-              while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn]) do
+              while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn,addn,subn]) do
                 hp:=tunarynode(hp).left;
               if (hp.nodetype=loadn) then
                 begin
@@ -927,6 +927,28 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
                   while assigned(hp) and (hp.nodetype<>loadn) do
                     begin
                        case hp.nodetype of
+                         addn :
+                           begin
+                             if (is_constintnode(taddnode(hp).right) or
+                               is_constenumnode(taddnode(hp).right) or
+                               is_constcharnode(taddnode(hp).right) or
+                               is_constboolnode(taddnode(hp).right)) and
+                               is_pointer(taddnode(hp).left.resultdef) then
+                               ftcb.queue_addn(tpointerdef(taddnode(hp).left.resultdef).pointeddef,get_ordinal_value(taddnode(hp).right))
+                             else
+                               Message(parser_e_illegal_expression);
+                           end;
+                         subn :
+                           begin
+                             if (is_constintnode(taddnode(hp).right) or
+                               is_constenumnode(taddnode(hp).right) or
+                               is_constcharnode(taddnode(hp).right) or
+                               is_constboolnode(taddnode(hp).right)) and
+                               is_pointer(taddnode(hp).left.resultdef) then
+                               ftcb.queue_subn(tpointerdef(taddnode(hp).left.resultdef).pointeddef,get_ordinal_value(taddnode(hp).right))
+                             else
+                               Message(parser_e_illegal_expression);
+                           end;
                          vecn :
                            begin
                              if (is_constintnode(tvecnode(hp).right) or

+ 3 - 0
compiler/utils/msg2inc.pp

@@ -730,6 +730,9 @@ begin
                end;
               if s[i+k]='_' then
                inc(i,k+1);
+              if number<>'' then
+                writeln(t,'\index[msgnr]{',number,'}');
+              writeln(t,'\index[msgtxt]{',escapestring(Copy(s,i,255)),'}');
               writeln(t,'\item ['+s1+escapestring(Copy(s,i,255))+'] \hfill \\');
             end
            else

+ 1 - 1
packages/symbolic/src/symbolic.pas

@@ -240,7 +240,7 @@ const InfixOperatorName   : array[addo..powo] of char= ('+','-','*','/','^');
              'LOG10','LOG2','LNXP1','!','ARCTAN2',
              'STEP','POWER','HYPOT','LOGN');
      LenFunctionNames : array[cosx..lognx] of longint=
-             (3,3,3,3,3,3,2,3,1,5,6,6,6,4,4,4,7,7,7,5,4,5,1,7,4,5,5,4);
+             (3,3,3,3,4,3,2,3,1,5,6,6,6,4,4,4,7,7,7,5,4,5,1,7,4,5,5,4);
 
 {$I exprstrs.inc}
 

+ 2 - 2
rtl/linux/linux.pp

@@ -556,7 +556,7 @@ Type
    tkernel_timespecs = array[0..1] of kernel_timespec;
 
 {$ifndef android}
-Function utimensat(dfd: cint; path:pchar;const times:tkernel_timespecs;flags:cint):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'statx'; {$ENDIF}
+Function utimensat(dfd: cint; path:pchar;const times:tkernel_timespecs;flags:cint):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'utimensat'; {$ENDIF}
 Function futimens(fd: cint; const times:tkernel_timespecs):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'futimens'; {$ENDIF}
 {$endif android}
 
@@ -875,7 +875,6 @@ begin
   statx:=do_syscall(syscall_nr_statx,TSysParam(dfd),TSysParam(filename),TSysParam(flags),TSysParam(mask),TSysParam(@buf));
 end;
 
-{$endif}
 
 {$ifndef android}
 Function utimensat(dfd: cint; path:pchar;const times:tkernel_timespecs;flags:cint):cint;
@@ -917,6 +916,7 @@ begin
 {$endif sizeof(clong)<=4}
 end;
 {$endif android}
+{$endif not FPC_USE_LIBC}
 
 end.
 

+ 18 - 6
rtl/linux/x86_64/syscall.inc

@@ -20,9 +20,10 @@
 procedure mcount; external name 'mcount';
 {$endif FPC_PROFILE}
 
-function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
+function FpSysCall(sysnr:TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL0'];
 
 asm
+  pushq %rax              { keep stack aligned }
 {$ifdef FPC_PROFILE}
   pushq sysnr
   call mcount
@@ -37,11 +38,13 @@ asm
   call  seterrno@PLT
   movq  $-1,%rax
 .LSyscOK:
+  popq %rcx               { remove alignment }
 end;
 
-function FpSysCall(sysnr,param1 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
+function FpSysCall(sysnr,param1 : TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL1'];
 
 asm
+  pushq %rax              { keep stack aligned }
 {$ifdef FPC_PROFILE}
   pushq sysnr
   pushq param1
@@ -59,11 +62,13 @@ asm
   call  seterrno@PLT
   movq  $-1,%rax
 .LSyscOK:
+  popq %rcx               { remove alignment }
 end;
 
-function FpSysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
+function FpSysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL2'];
 
 asm
+  pushq %rax              { keep stack aligned }
 {$ifdef FPC_PROFILE}
   pushq sysnr
   pushq param1
@@ -84,11 +89,13 @@ asm
   call  seterrno@PLT
   movq  $-1,%rax
 .LSyscOK:
+  popq %rcx               { remove alignment }
 end;
 
-function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
+function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL3'];
 
 asm
+  pushq %rax              { keep stack aligned }
 {$ifdef FPC_PROFILE}
   pushq sysnr
   pushq param1
@@ -112,11 +119,13 @@ asm
   call  seterrno@PLT
   movq  $-1,%rax
 .LSyscOK:
+  popq %rcx               { remove alignment }
 end;
 
-function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
+function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL4'];
 
 asm
+  pushq %rax              { keep stack aligned }
 {$ifdef FPC_PROFILE}
   pushq sysnr
   pushq param1
@@ -143,11 +152,13 @@ asm
   call  seterrno@PLT
   movq  $-1,%rax
 .LSyscOK:
+  popq %rcx               { remove alignment }
 end;
 
-function FpSysCall(sysnr,param1,param2,param3,param4,param5 : TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
+function FpSysCall(sysnr,param1,param2,param3,param4,param5 : TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL5'];
 
 asm
+  pushq %rax              { keep stack aligned }
 {$ifdef FPC_PROFILE}
   pushq sysnr
   pushq param1
@@ -177,6 +188,7 @@ asm
   call  seterrno@PLT
   movq  $-1,%rax
 .LSyscOK:
+  popq %rcx               { remove alignment }
 end;
 
 

+ 4 - 2
rtl/unix/sysutils.pp

@@ -569,7 +569,7 @@ begin
 
 {$ifdef USE_STATX}
   { first try statx }
-  if (statx(0,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
+  if (statx(AT_FDCWD,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
     begin
       Result:=Infox.stx_mtime.tv_sec;
       exit;
@@ -1082,10 +1082,12 @@ Var
 {$ifdef USE_STATX}
   Infox : TStatx;
 {$endif USE_STATX}
+  Char0 : char;
 begin
   Result:=-1;
 {$ifdef USE_STATX}
-  if statx(Handle,nil,0,STATX_MTIME,Infox)=0 then
+  Char0:=#0;
+  if statx(Handle,@Char0,AT_EMPTY_PATH,STATX_MTIME,Infox)=0 then
     Result:=Infox.stx_Mtime.tv_sec
   else if fpgeterrno=ESysENOSYS then
 {$endif USE_STATX}

+ 6 - 0
tests/test/units/sysutils/tfile1.pp

@@ -39,6 +39,12 @@ BEGIN
     do_error(1003);
   Close(f);
 
+  Assign(f,'datetest.dat');
+  Reset(f);
+  if FileGetDate(filerec(f).handle)<>DateTimeToFileDate(dateTime) then
+    do_error(1004);
+  Close(f);
+
   if FileExists('datetest.dat') then
     begin
       Assign(f,'datetest.dat');

+ 8 - 0
tests/test/units/sysutils/tfileage.pp

@@ -7,4 +7,12 @@ begin
       writeln('Compilation time and run time differ too much, SysUtils.FileAge buggy?');
       halt(1);
     end;
+
+  { test with relative path }
+  if 3600*24*(now()-FileDateToDateTime(FileAge(ExtractRelativePath(GetCurrentDir+DirectorySeparator,paramstr(0)))))>7200 then
+    begin
+      writeln('FileAge returns: ',FileDateToDateTime(FileAge(paramstr(0))));
+      writeln('Compilation time and run time differ too much, SysUtils.FileAge buggy?');
+      halt(1);
+    end;
 end.

+ 13 - 0
tests/webtbf/tw24434.pp

@@ -0,0 +1,13 @@
+{ %fail }
+function f(s: string): string;
+begin
+  f := '''' + s + '''';
+end;
+
+function f(s: string): integer;
+begin
+  Val(s,f);
+end;
+
+begin
+end.

+ 11 - 0
tests/webtbs/tw32139.pp

@@ -0,0 +1,11 @@
+{ %OPT=-Seh }
+program Test;
+
+{$HINTS ON}
+
+var
+  cur: Currency;
+begin
+  cur := 3.5;
+  cur := cur / 1.5;
+end.

+ 27 - 0
tests/webtbs/tw34027.pp

@@ -0,0 +1,27 @@
+uses
+  strings;
+
+type tz = record
+       name : pchar;
+     end;
+const aa :array[0..2] of char = 'aa'#0;
+
+const testArrZ : array [0..4] of tz = (
+     (name: @aa), { Ok }
+     (name: pchar(@aa)), { Ok }
+     (name: pchar(@aa)+1),
+     (name: pchar(@aa)+1+1),
+     (name: pchar(@aa)+1+1-1)
+     );
+
+var b : pchar;
+
+begin
+  b:=pchar(@aa)+1; {Ok}
+  if strlen(testArrZ[2].name)<>1 then
+    halt(1);
+  if strlen(testArrZ[3].name)<>0 then
+    halt(2);
+  if strlen(testArrZ[4].name)<>1 then
+    halt(2);
+end.