[fpc-devel] strange (?) "result not initialized"

Martin fpc at mfriebe.de
Thu Aug 20 19:12:46 CEST 2020


In the code below / with fpc 3.2

function TDwarfInformationEntry.ReadName(out AName: PChar): Boolean;
var
   AttrData: TDwarfAttribData;
begin
   PrepareAbbrev;
   if dafHasName in FAbbrev^.flags then begin
     Result := GetAttribData(DW_AT_name, AttrData);
     assert(Result and (AttrData.InformationEntry = Self), 
'TDwarfInformationEntry.ReadName');
     Result := ReadValue(AttrData, AName);
   end
   else
   if (dafHasAbstractOrigin in FAbbrev^.flags) and PrepareAbstractOrigin 
then
     Result := FAbstractOrigin.ReadName(AName)    // 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   else
     Result := False;
end;

components\fpdebug\fpdbgdwarfdataclasses.pas
line 2875

The indicate line says "fpdbgdwarfdataclasses.pas(2870,30) Warning: 
Function result variable does not seem to be initialized"
And I get the warning 5 times.

I also get one (just one) such warning on:
- the "begin" line of the function
- the "PrepareAbbrev" line (which is a call to a procedure)

This appears to be, due to the function being marked "inline".
If I remove the "inline" then the warning goes.

---
Unrelated:

I also get the obvious
fpdbgdwarfdataclasses.pas(2887,30) Note: Call to subroutine "function 
TDwarfInformationEntry.ReadName(out AName:PChar):Boolean;" marked as 
inline is not inlined

Of course a call to the function itself is not inlined.....
(Well yes, it could be a few times, like loop unroll / but does that 
warrant a warning?)


More information about the fpc-devel mailing list