[fpc-devel] fpc bug with M1

Florian Klämpfl florian at freepascal.org
Thu Dec 30 17:16:14 CET 2021

Am 30.12.21 um 14:52 schrieb Jonas Maebe via fpc-devel:
> On 29/12/2021 00:48, Martin Frb via fpc-devel wrote:
>> I don't have an M1 myself, but according to the data from the thread 
>> on the lazarus mail list, there is a bug in the 3.3.1 asm generator 
>> for M1
>> var pn8: pint8; // pointer signed byte
>> In the below expression ...(not pn8^)...
>> "pn8^" is loaded to w0 and sign extended. From this point onwards 
>> operations on the value should be 32 bits (the value has been 
>> extended, and the full 32 bits are later used).
>> but "not" only affects the lowest 8 bit.
>> Apparently in 3.2.2 (or was it 3.2.0) there was
>> mvn w0,w0
>> If someone can confirm tihs....
> It's probably caused by c90616944d3bde7b36e924d27a0790195d61f95c (Florian)

Isn't the sign extension during the load wrong? Martin didn't post the 
whole assemble code but I would expect that 3.2.2 produced an uxtb 
instruction afterwards which hide the problem.

More information about the fpc-devel mailing list