View Issue Details

IDProjectCategoryView StatusLast Update
0038733FPCCompilerpublic2021-04-09 22:22
ReporterKieran Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86-64OSLinux 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038733: Internal error 200405022 when using include() on a set within the result of a function with -O2
DescriptionCompiler throws fatal error, sample program attached & in additional info.
Steps To ReproduceCompile 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];
TagsNo tags attached.
Fixed in Revision49151
FPCOldBugId
FPCTarget-
Attached Files

Activities

Kieran

2021-04-09 12:06

reporter  

SetResultRecord.pp (770 bytes)   
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 := [];

	//this 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.
SetResultRecord.pp (770 bytes)   

Issue History

Date Modified Username Field Change
2021-04-09 12:06 Kieran New Issue
2021-04-09 12:06 Kieran File Added: SetResultRecord.pp
2021-04-09 22:22 Florian Assigned To => Florian
2021-04-09 22:22 Florian Status new => resolved
2021-04-09 22:22 Florian Resolution open => fixed
2021-04-09 22:22 Florian Fixed in Version => 3.3.1
2021-04-09 22:22 Florian Fixed in Revision => 49151
2021-04-09 22:22 Florian FPCTarget => -