[fpc-devel] [Suggestion] Enumeration range-check intrinsic

Florian Klämpfl florian at freepascal.org
Sun Jul 7 10:24:15 CEST 2019


Am 07.07.2019 um 07:33 schrieb J. Gareth Moreton:
> Maybe I'm missing something painfully 
> obvious here. Can I request an example 
> where such an invalid value/undefined 
> behaviour crops up in bitpacked records so 
> I can see what's going on? Logic dictates 
> that the number of bits required to store 
> an enum in that arrangement is equal to 
> the index of the highest element, although 
> that's without looking at the source code 
> and doesn't account for elements that have 
> assigned negative values.
> 
> In the meantime, I'm working on making 
> "as" and "is" work with ordinal types as 
> well as enumerations, although currently 
> some headaches occur if the right-hand 
> side is larger than the CPU word size 
> (e.g. Int64 on i386). I'll upload the 
> patch to the issue once it's working 
> properly.

I strongly recommend to add these changes at node level, then you do not have to fiddle with the alu sizes of different
CPUs.


More information about the fpc-devel mailing list