View Issue Details

IDProjectCategoryView StatusLast Update
0036960FPCDocumentationpublic2020-04-23 19:21
ReporterFrederic Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.4 
Fixed in Version3.3.1 
Summary0036960: SetLength Documentation missing 0-Case Documentation
DescriptionThe documentation of SetLength (https://www.freepascal.org/docs-html/rtl/system/setlength.html) does not state anything about the case when length 0 is given.

In practice it frees the array, which actually is in conflict with the following line from the doc: "the reference count after a call to SetLength will be 1". But the reference count of nil is 0.
Steps To Reproduce    program Project1;
     
    {$mode objfpc}{$H+}
     
    var s: String;
    begin
      SetLength(s, 0);
      WriteLn(StringRefCount(s));
    end.

This results in 0, not 1 as the documentation would suggest
TagsNo tags attached.
Fixed in Revision1692
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

Michael Van Canneyt

2020-04-23 19:21

administrator   ~0122369

Fixed. Thanks for reporting!

Issue History

Date Modified Username Field Change
2020-04-23 19:08 Frederic New Issue
2020-04-23 19:08 Frederic Status new => assigned
2020-04-23 19:08 Frederic Assigned To => Michael Van Canneyt
2020-04-23 19:21 Michael Van Canneyt Status assigned => resolved
2020-04-23 19:21 Michael Van Canneyt Resolution open => fixed
2020-04-23 19:21 Michael Van Canneyt Fixed in Version => 3.3.1
2020-04-23 19:21 Michael Van Canneyt Fixed in Revision => 1692
2020-04-23 19:21 Michael Van Canneyt FPCTarget => 3.2.0
2020-04-23 19:21 Michael Van Canneyt Note Added: 0122369