Internal error 200405022 when using include() on a set within the result of a function with -O2
Original Reporter info from Mantis: km
-
Reporter name: Kieran
Original Reporter info from Mantis: km
- Reporter name: Kieran
Description:
Compiler throws fatal error, sample program attached & in additional info.
Steps to reproduce:
Compile attached program with -O2, pasted below:
program SetResultRecord;
//fpc -O2 SetResultRecord.pp
type
TSimpleEnum = (seOne, seTwo);
TSimpleSet = set of TSimpleEnum;
TRecordWithSet = record
TheSet : TSimpleSet;
end;
function FirstFunc:TRecordWithSet;
begin
FirstFunc.TheSet := [];
//below would work fine
//FirstFunc.TheSet := FirstFunc.TheSet + [seOne];
//below line causes error "Fatal: Internal error 200405022"
Include(FirstFunc.TheSet, seOne);
end;
//absolute variable overlaying Result doesn't help
function SecondFunc:TRecordWithSet;
var
LocalAbs : TRecordWithSet absolute SecondFunc;
begin
LocalAbs.TheSet := [];
//below line would cause same error
Include(LocalAbs.TheSet, seOne);
end;
var
Collected : TRecordWithSet;
begin
Collected := FirstFunc;
end.
Additional information:
-O1 works fine
Adding two sets together works fine:
FirstFunc.TheSet := FirstFunc.TheSet + [seOne];
Mantis conversion info:
- Mantis ID: 38733
- OS: Linux
- Build: 49150
- Platform: x86-64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 49151 (#b09669df)