View Issue Details

IDProjectCategoryView StatusLast Update
0035378FPCRTLpublic2019-04-16 09:24
ReporterThaddy de Koning Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_86OSWindwows 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0035378: sysutils.NativeInt.Minvalue gives wrong result (0)
DescriptionSysUtils.NativeInt.MinValue renders 0 instead of -9223372036854775808
Steps To Reproduceprogram Testhelpers;
{$mode objfpc}
uses sysutils;
begin
  writeln(NativeInt.MinValue); // 0 wrong
  writeln(Low(NativeInt)); // -9223372036854775808 correct
end.
TagsNo tags attached.
Fixed in Revision41881
FPCOldBugId
FPCTarget
Attached Files

Activities

Thaddy de Koning

2019-04-14 07:36

reporter   ~0115493

Last edited: 2019-04-14 07:37

View 2 revisions

The fix is easy:
  TNativeIntHelper = Type Helper for NativeInt
  public
    const
      MaxValue = High(NativeInt);
      MinValue = Low(NativeUInt); <-----

should be:
  TNativeIntHelper = Type Helper for NativeInt
  public
    const
      MaxValue = High(NativeInt);
      MinValue = Low(NativeInt);

Simple typo, I guess

Thaddy de Koning

2019-04-14 07:45

reporter   ~0115495

Patch attached

Thaddy de Koning

2019-04-14 07:46

reporter  

syshelph.patch (502 bytes)   
Index: rtl/objpas/sysutils/syshelph.inc
===================================================================
--- rtl/objpas/sysutils/syshelph.inc	(revision 41845)
+++ rtl/objpas/sysutils/syshelph.inc	(working copy)
@@ -523,7 +523,7 @@
   public
     const
       MaxValue = High(NativeInt);
-      MinValue = Low(NativeUInt);
+      MinValue = Low(NativeInt);
   Public
     Class Function Parse(const AString: string): NativeInt; inline; static;
     Class Function Size: Integer; inline; static;
syshelph.patch (502 bytes)   

Thaddy de Koning

2019-04-14 10:40

reporter   ~0115499

For completeness: affects all platforms, not just win64.

Sven Barth

2019-04-16 09:24

manager   ~0115542

Thanks for the patch. Please test and close if okay.

Issue History

Date Modified Username Field Change
2019-04-14 07:14 Thaddy de Koning New Issue
2019-04-14 07:36 Thaddy de Koning Note Added: 0115493
2019-04-14 07:37 Thaddy de Koning Note Edited: 0115493 View Revisions
2019-04-14 07:45 Thaddy de Koning Note Added: 0115495
2019-04-14 07:46 Thaddy de Koning File Added: syshelph.patch
2019-04-14 10:40 Thaddy de Koning Note Added: 0115499
2019-04-16 09:24 Sven Barth Fixed in Revision => 41881
2019-04-16 09:24 Sven Barth Note Added: 0115542
2019-04-16 09:24 Sven Barth Status new => resolved
2019-04-16 09:24 Sven Barth Fixed in Version => 3.3.1
2019-04-16 09:24 Sven Barth Resolution open => fixed
2019-04-16 09:24 Sven Barth Assigned To => Sven Barth