Run Initialize for static arrays of managed records (Fixes #41451)

Summary

Implicit finalization already covered managed static variables, but the paired initialization only accepted a top-level record or object, so a fixed array of advanced records received Finalize without Initialize.

Add one value-storage predicate, has_non_trivial_value_init, that recurses only through records, fixed arrays and old-style objects, and use it both for the initialization walk and for the sto_has_non_trivial_init symtable flag. Class and interface references are excluded, so a large static string array is still initialized by a single zero fill.

Fixes #41451. Test: tests/webtbs/tw41451.pp.

System

  • Operating system: all (verified on Windows 11)
  • Processor architecture: all (verified on x86-64)
  • Device: Computer

What is the current bug behavior?

The Initialize management operator of the record is never called for the elements of a static array; the test exits with code 1.

What is the behavior after applying this patch?

Initialize runs once per element at unit/program start; Finalize is unchanged. The test exits 0.

Relevant logs and/or screenshots

Verified on x86_64-win64 main (2efddc1b): red before, green after. Also proposed to Unleashed Pascal as PR #45, which waits for this MR.

Merge request reports

Loading
Loading