Forum > General
SIGSEGV with Optimization level 2 enabled
(1/1)
ggallo:
Hi All!
I have a strange problem what I can't resolve. When I enable level 2 optimization, my program exits with SIGSEGV, with level 1 or 0 there is no problem.
The code I'm using that causes the SIGSEGV:
--- Code: ---procedure TAppUser.CompaniesAsStringList(AStrList: TStrings);
var
TempCompany: TCompany;
begin
if Assigned(AStrList) then
begin
AStrList.Clear;
AStrList.AddObject(FDefaultCompany.Name, TObject(FDefaultCompany.ID));
for TCollectionItem(TempCompany) in FCompanies do
AStrList.AddObject(TempCompany.Name, TObject(TempCompany.ID));
end;
end;
--- End code ---
I call this as follows:
--- Code: ---FUser.CompaniesAsStringList(cbFirm.Items);
--- End code ---
The cbFirms is a TComboBox, the items filled with company names the current user can choose from.
With optimization level 0 or 1 there are no problems. With level 2 or 3, when AStrList.Clear ran, the AStrList canged to Nil, so next call causes SIGSEGV.
I can't figure out why this happens or how can I resolve it.
I'm using Lazarus 1.2.2 with FPC 2.6.4, on Windows 7 Home Premium 64 bit (Core i3-3220, 8GB). The same error occurs on (same host machine, but in a VirtualBox session) openSuSE 12.3 - 32 bit, same Lazarus and FPC.
Leledumbo:
--- Code: ---Test with FPC trunk;
if the issue still appears then
Report to the bug tracker
else
Use FPC trunk;
--- End code ---
Navigation
[0] Message Index