SIGSEGV with Optimization level 2 enabled lazarus / 62-General ---------------------------------------------------------------------- ggallo · 2014-08-18 07:58 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: [Select]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; I call this as follows: Code: [Select]FUser.CompaniesAsStringList(cbFirm.Items); 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 · 2014-08-18 09:31 Code: [Select]Test with FPC trunk; if the issue still appears then   Report to the bug tracker else   Use FPC trunk;