Skip to content

smallint aarch64 codegen trouble with -O2 option

Summary

Basic test from testsuite test/units/system/tincdec.pp fails for aarch64 CPU target when -O2 option (or higher) is used.

System Information

  • Operating system: Any
  • Processor architecture: aarch64
  • Compiler version: trunk 3.3.1
  • Device: Any

Steps to reproduce

Recompile test/units/system/tincdec.pp with trunk aarch64 compiler and option -O2

Example Project

What is the current bug behavior?

Test fails with run time error 2, which indicates a problem with 16-bit signed integers code.

What is the expected (correct) behavior?

The test should succeed.

``` https://www.freepascal.org/testsuite/cgi-bin/new-testsuite2.cgi?action=4&testfilename=test%2Funits%2Fsystem%2Ftincdec.pp&os=15&cpu=8&version=0&date=&submitter=&machine=gcc103&comment=%25-O3%25&limit=350&cond=&Category=3&failedonly=1&noskipped=1&listall=1 ````

seems to show that this test fails since Marc 20. 2022

Relevant logs and/or screenshots

It seems that the 16-bit value gets loaded into a 32-bit register, but the value is not correctly sign extended to 32-bit.

Possible fixes

Add instruction to do the sign extension to 32-bit.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information