[fpc-pascal] rtl-generics: TIStringComparer.Ordinal -> Access violation

silvioprog silvioprog at gmail.com
Wed Aug 17 16:05:18 CEST 2016


On Wed, Aug 17, 2016 at 3:04 AM, Maciej Izak <hnb.code at gmail.com> wrote:

>
> 2016-08-17 7:05 GMT+02:00 silvioprog <silvioprog at gmail.com>:
>
>> Just try it:
>>
>
> related to
>
> http://bugs.freepascal.org/view.php?id=28911
>
> Sven comment: "I won't change the current implementation for now, because
> once I'm going to fix this I'm going to fix this correctly for all cases,
> including packages, everything else is merely a workaround. But for that I
> first need to finish my work on packages."
>
> btw, already reported: http://bugs.freepascal.org/view.php?id=30433
>

Indeed. After some debug I found where the exception is raised:

...
function TOpenAddressingLP<OPEN_ADDRESSING_CONSTRAINTS>.FindBucketIndex(constref
AItems: TArray<TItem>;
  constref AKey: TKey; out AHash: UInt32): SizeInt;
var
  LItem: {TOpenAddressing<OPEN_ADDRESSING_CONSTRAINTS>.}_TItem; // for
workaround Lazarus bug #25613
  LLengthMask: SizeInt;
  i, m: SizeInt;
  LHash: UInt32;
begin
  m := Length(AItems);
  LLengthMask := m - 1;

  LHash := FEqualityComparer.GetHashCode(AKey); // << here
...

but I can't step into FEqualityComparer.GetHashCode to check why it
happens, so I'll wait for Sven too. ^^

I need to find the values using case-insensitive keys (I'm using it in a
class registry of my app), so unfortunately this bug doesn't let me to use
TDictionary on FPC yet. :-(

--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160817/c739408f/attachment.html>


More information about the fpc-pascal mailing list