aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/fe.h
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2022-06-07 13:22:04 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-12 12:24:12 +0000
commitbe4ab2ae015e1e18a4e5b57ab5d87e6f30e6749e (patch)
treefe03293b2872fc585388b403d3cc33fd9edef1ee /gcc/ada/fe.h
parenta8d17a88a52d2f773423adb55399d23ed5ea03c8 (diff)
downloadgcc-be4ab2ae015e1e18a4e5b57ab5d87e6f30e6749e.zip
gcc-be4ab2ae015e1e18a4e5b57ab5d87e6f30e6749e.tar.gz
gcc-be4ab2ae015e1e18a4e5b57ab5d87e6f30e6749e.tar.bz2
[Ada] Proper freezing for dispatching expression functions.
In the case of an expression function that is a primitive function of a tagged type, freezing the tagged type needs to freeze the function (and its return expression). A bug in this area could result in incorrect behavior both at compile time and at run time. At compile time, freezing rule violations could go undetected so that an illegal program could be incorrectly accepted. At run time, a dispatching call to the primitive function could end up dispatching through a not-yet-initialized slot in the dispatch table, typically (although not always) resulting in a segmentation fault. gcc/ada/ * freeze.adb (Check_Expression_Function.Find_Constant): Add a check that a type that is referenced as the prefix of an attribute is fully declared. (Freeze_And_Append): Do not freeze the profile when freezing an expression function. (Freeze_Entity): When a tagged type is frozen, also freeze any primitive operations of the type that are expression functions. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not prevent freezing associated with an expression function body if the function is a dispatching op.
Diffstat (limited to 'gcc/ada/fe.h')
0 files changed, 0 insertions, 0 deletions