Browse Source

* RTL: fixed some warnings when compiling for x86_64:
* x86_64/x86_64.inc: IsMultithread is a LongBool, not Boolean -> fixed assembler instruction suffixes
* inc/generic.inc: cast Sizeof() to unsigned, so that combining it with unsigned operands does not cause promotion to larger signed type.
+ win64/seh64.inc: explicit typecast and missing function result assignment.
+ inc/genmath.inc: explicit typecasts.

git-svn-id: trunk@25384 -

sergei 12 years ago
parent
commit
690995fa12
4 changed files with 16 additions and 16 deletions
  1. 4 5
      rtl/inc/generic.inc
  2. 2 2
      rtl/inc/genmath.inc
  3. 2 1
      rtl/win64/seh64.inc
  4. 8 8
      rtl/x86_64/x86_64.inc

+ 4 - 5
rtl/inc/generic.inc

@@ -358,7 +358,7 @@ begin
   if (len < 0) or
   if (len < 0) or
      (len > high(PtrInt) div 2) or
      (len > high(PtrInt) div 2) or
      (psrc+len < psrc) then
      (psrc+len < psrc) then
-    pend:=pdword(high(PtrUInt)-sizeof(dword))
+    pend:=pdword(high(PtrUInt)-PtrUInt(sizeof(dword)))
   else
   else
     pend:=psrc+len;
     pend:=psrc+len;
 {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
 {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
@@ -399,7 +399,7 @@ begin
   if (len < 0) or
   if (len < 0) or
      (len > high(PtrInt) div 4) or
      (len > high(PtrInt) div 4) or
      (psrc+len < psrc) then
      (psrc+len < psrc) then
-    pend:=pqword(high(PtrUInt)-sizeof(qword))
+    pend:=pqword(high(PtrUInt)-PtrUInt(sizeof(qword)))
   else
   else
     pend:=psrc+len;
     pend:=psrc+len;
 {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
 {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
@@ -548,8 +548,7 @@ begin
           inc(pptruint(psrc));
           inc(pptruint(psrc));
         end;
         end;
     end;
     end;
-  if (len <= high(ptrint)) and
-     (psrc+len >= psrc) then
+  if (psrc+len >= psrc) then
     pend:=psrc+len
     pend:=psrc+len
   else
   else
     pend:=pword(high(ptruint)-2);
     pend:=pword(high(ptruint)-2);
@@ -689,7 +688,7 @@ begin
   { simulate assembler implementations behaviour, which is expected }
   { simulate assembler implementations behaviour, which is expected }
   { fpc_pchar_to_ansistr in astrings.inc                            }
   { fpc_pchar_to_ansistr in astrings.inc                            }
   if (len < 0) then
   if (len < 0) then
-    pend:=pbyte(high(PtrUInt)-sizeof(byte))
+    pend:=pbyte(high(PtrUInt)-PtrUInt(sizeof(byte)))
   else
   else
     pend:=psrc+len;
     pend:=psrc+len;
   while (psrc<pend) and (psrc^<>0) do
   while (psrc<pend) and (psrc^<>0) do

+ 2 - 2
rtl/inc/genmath.inc

@@ -224,7 +224,7 @@ type
 invalid:
 invalid:
            float_raise(float_flag_invalid);
            float_raise(float_flag_invalid);
            if (aSign <> 0) then
            if (aSign <> 0) then
-             float64_to_int32_round_to_zero:=$80000000
+             float64_to_int32_round_to_zero:=longint($80000000)
            else
            else
              float64_to_int32_round_to_zero:=$7FFFFFFF;
              float64_to_int32_round_to_zero:=$7FFFFFFF;
            exit;
            exit;
@@ -333,7 +333,7 @@ invalid:
                    exit;
                    exit;
                  end;
                  end;
              End;
              End;
-           float32_to_int32_round_to_zero:=$80000000;
+           float32_to_int32_round_to_zero:=longint($80000000);
            exit;
            exit;
          End
          End
        else
        else

+ 2 - 1
rtl/win64/seh64.inc

@@ -304,6 +304,7 @@ begin
   args[1]:=PtrUint(Obj);
   args[1]:=PtrUint(Obj);
   args[2]:=GetBacktrace(ctx,AFrame,PPointer(args[3]));
   args[2]:=GetBacktrace(ctx,AFrame,PPointer(args[3]));
   RaiseException(FPC_EXCEPTION_CODE,EXCEPTION_NONCONTINUABLE,4,@args[0]);
   RaiseException(FPC_EXCEPTION_CODE,EXCEPTION_NONCONTINUABLE,4,@args[0]);
+  result:=nil;
 end;
 end;
 
 
 procedure _fpc_local_unwind(frame,target: Pointer);[public,alias:'_FPC_local_unwind'];compilerproc;
 procedure _fpc_local_unwind(frame,target: Pointer);[public,alias:'_FPC_local_unwind'];compilerproc;
@@ -429,7 +430,7 @@ var
 begin
 begin
   Adr:=rec.ExceptionInformation[0];
   Adr:=rec.ExceptionInformation[0];
   Obj:=TObject(rec.ExceptionInformation[1]);
   Obj:=TObject(rec.ExceptionInformation[1]);
-  Framecount:=Longint(rec.ExceptionInformation[2]);
+  Framecount:=Longint(PtrUInt(rec.ExceptionInformation[2]));
   Frames:=rec.ExceptionInformation[3];
   Frames:=rec.ExceptionInformation[3];
 
 
   if rec.ExceptionCode<>FPC_EXCEPTION_CODE then
   if rec.ExceptionCode<>FPC_EXCEPTION_CODE then

+ 8 - 8
rtl/x86_64/x86_64.inc

@@ -673,9 +673,9 @@ function declocked(var l : longint) : boolean;assembler; nostackframe;
      { of time!                                             }
      { of time!                                             }
 {$ifdef FPC_PIC}
 {$ifdef FPC_PIC}
      movq       IsMultithread@GOTPCREL(%rip),%rax
      movq       IsMultithread@GOTPCREL(%rip),%rax
-     cmpb       $0,(%rax)
+     cmpl       $0,(%rax)
 {$else FPC_PIC}
 {$else FPC_PIC}
-     cmpb       $0,IsMultithread(%rip)
+     cmpl       $0,IsMultithread(%rip)
 {$endif FPC_PIC}
 {$endif FPC_PIC}
 {$ifndef win64}
 {$ifndef win64}
      mov        %rdi, %rcx
      mov        %rdi, %rcx
@@ -698,9 +698,9 @@ function declocked(var l : int64) : boolean;assembler; nostackframe;
      { of time!                                             }
      { of time!                                             }
 {$ifdef FPC_PIC}
 {$ifdef FPC_PIC}
      movq       IsMultithread@GOTPCREL(%rip),%rax
      movq       IsMultithread@GOTPCREL(%rip),%rax
-     cmpb       $0,(%rax)
+     cmpl       $0,(%rax)
 {$else FPC_PIC}
 {$else FPC_PIC}
-     cmpb       $0,IsMultithread(%rip)
+     cmpl       $0,IsMultithread(%rip)
 {$endif FPC_PIC}
 {$endif FPC_PIC}
 {$ifndef win64}
 {$ifndef win64}
      mov        %rdi, %rcx
      mov        %rdi, %rcx
@@ -724,9 +724,9 @@ procedure inclocked(var l : longint);assembler; nostackframe;
      { of time!                                             }
      { of time!                                             }
 {$ifdef FPC_PIC}
 {$ifdef FPC_PIC}
      movq       IsMultithread@GOTPCREL(%rip),%rax
      movq       IsMultithread@GOTPCREL(%rip),%rax
-     cmpb       $0,(%rax)
+     cmpl       $0,(%rax)
 {$else FPC_PIC}
 {$else FPC_PIC}
-     cmpb       $0,IsMultithread(%rip)
+     cmpl       $0,IsMultithread(%rip)
 {$endif FPC_PIC}
 {$endif FPC_PIC}
 {$ifndef win64}
 {$ifndef win64}
      mov        %rdi, %rcx
      mov        %rdi, %rcx
@@ -749,9 +749,9 @@ procedure inclocked(var l : int64);assembler; nostackframe;
      { of time!                                             }
      { of time!                                             }
 {$ifdef FPC_PIC}
 {$ifdef FPC_PIC}
      movq       IsMultithread@GOTPCREL(%rip),%rax
      movq       IsMultithread@GOTPCREL(%rip),%rax
-     cmpb       $0,(%rax)
+     cmpl       $0,(%rax)
 {$else FPC_PIC}
 {$else FPC_PIC}
-     cmpb       $0,IsMultithread(%rip)
+     cmpl       $0,IsMultithread(%rip)
 {$endif FPC_PIC}
 {$endif FPC_PIC}
 {$ifndef win64}
 {$ifndef win64}
      mov        %rdi, %rcx
      mov        %rdi, %rcx