Skip to content

Fix for lack of error message on bad alignment

Summary

This merge request now causes the compiler to throw an error if align is used on a record type and the alignment is not a power of 2.

System

  • Operating system: All
  • Processor architecture: All
  • Device: All

What is the current bug behavior?

If a bad alignment is specified (e.g. type RecordType = record ... end align 3;), it is silently ignored and no error is thrown. This carries the risk of unpredictable behaviour for the compiled program.

What is the behavior after applying this patch?

An error is thrown if the alignment is not a power of 2 or is greater than 64 (alignment is currently stored internally as a ShortInt, so 128 and above cannot be stored).

Additional Notes

This is a relatively simplistic change that reuses an error message instead of creating a new one.

Merge request reports