View Issue Details

IDProjectCategoryView StatusLast Update
0037465FPCCompilerpublic2020-08-01 21:02
ReporterFrederic Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.2.0 
Summary0037465: Out Parameter referencing char of string not set when inlineing the function
DescriptionWhen a char of a string is used as out parameter for an inline function (or var parameter) then the function will simply not set the result, i.e. the write operations are discarded
Steps To ReproduceSee example
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Frederic

2020-08-01 19:47

reporter  

example.pas (172 bytes)   
program example;

{$mode objfpc}{$H+}

procedure foo(out c: char); inline;
begin
  c := #32;
end;

var s: String;

begin
  s:=#42;
  foo(s[1]);
  Writeln(ord(s[1]));
end.

example.pas (172 bytes)   

jamie philbrook

2020-08-01 21:02

reporter   ~0124471

Yes, you are correct 3.2.0 is generating non working code, it's also generating more code over what 3.0.4 for this operation.

 I looked at the ASM code and it is non working code with inline..

 Also.. I wanted to thank you for putting this report here because I have an app that has DLL's and when using 3.2.0 the DLL's become fatter and slower and I get bad data where as they work using 3.0.4.

   It just so happens that I do have some operations INLINED like this using strings and static type arrays and with the errors I am getting it kind of points to what you found.

 Thank You.

Issue History

Date Modified Username Field Change
2020-08-01 19:47 Frederic New Issue
2020-08-01 19:47 Frederic File Added: example.pas
2020-08-01 21:02 jamie philbrook Note Added: 0124471