]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Missing postcondition runtime check in inherited primitive
authorJavier Miranda <miranda@adacore.com>
Fri, 3 May 2024 17:52:20 +0000 (17:52 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 13 Jun 2024 13:30:34 +0000 (15:30 +0200)
commitdf898445c211cb417fad784d50a68bae0f20acbc
treead0bfa00064a29922a491b6a1e7eb2543223aa41
parent0662d7426835a69bf233c3f9a025b30e84563ff2
ada: Missing postcondition runtime check in inherited primitive

When a derived tagged type implements more interface interface types
than its parent type, and a primitive inherited from its parent type
covers a primitive of these additional interface types that has
classwide postconditions, the code generated by the compiler does not
check the classwide postconditions inherited from the interface primitive.

gcc/ada/

* freeze.ads (Check_Condition_Entities): Complete documentation.
* freeze.adb (Check_Inherited_Conditions): Extend its functionality to
build two kind of wrappers: the existing LSP wrappers, and wrappers
required to handle postconditions of interface primitives implemented
by inherited primitives.
(Build_Inherited_Condition_Pragmas): Rename formal.
(Freeze_Record_Type): For derived tagged types, move call to
Check_Inherited_Conditions to subprogram Freeze_Entity_Checks;
done to improve the performance of Check_Inherited_Conditions since it
can rely on the internal entities that link interface primitives with
tagged type primitives that implement them.
(Check_Interface_Primitives_Strub_Mode): New subprogram.
* sem_ch13.adb (Freeze_Entity_Checks): Call Check_Inherited_Conditions.
Call Check_Inherited_Conditions with derived interface types to check
strub mode compatibility of their primitives.
* sem_disp.adb (Check_Dispatching_Operation): Adjust assertion to accept
wrappers of interface primitives that have classwide postconditions.
* exp_disp.adb (Write_DT): Adding text to identify wrappers.
gcc/ada/exp_disp.adb
gcc/ada/freeze.adb
gcc/ada/freeze.ads
gcc/ada/sem_ch13.adb
gcc/ada/sem_disp.adb