SIGSEGV when asking for TObjectDictionary<TRecordWithTwoInt64Fields, TObject>.ContainsKey
Summary
A SIGSEGV is thrown when asking for ContainsKey
of a TObjectDictionary
of record containing two 64 bits integers -> some object.
System Information
- Operating system: Debian GNU/Linux 10 (buster)
- Processor architecture: x86-64
- Compiler version: trunk (44304224)
- Device: Desktop
Steps to reproduce
- Ask for
specialize TObjectDictionary<TRecord, TObject>.ContainsKey(something)
whereTRecord
contains two(!) entries ofInt64
type. Like a coordinate vector.
Example Project
program genericbug;
uses
Generics.Collections, Generics.Defaults;
type
TRec = record
X: Int64;
Y: Int64;
end;
TDict = specialize TObjectDictionary<TRec, TObject>;
var
Dict: TDict;
R: TRec;
begin
Dict := TDict.Create([doOwnsValues]);
R.X := 1;
R.Y := 1;
if not Dict.ContainsKey(R) then // <---------- SIGSEGV here
Dict.Add(R, TObject.Create);
Dict.Free;
end.
What is the current bug behavior?
SIGSEGV
What is the expected (correct) behavior?
Properly return false
.
Relevant logs and/or screenshots
Possible fixes
It seems to be a relatively recent bug. It was working without issues at Trunk version of around April 2022 at almost exactly the same environment (except for fpc+Lazarus version).