diff options
author | Javier Miranda <miranda@adacore.com> | 2024-10-08 18:33:37 +0000 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-11-04 16:57:55 +0100 |
commit | 74cdc0d576479756c7faa88f74b041cd9ff51636 (patch) | |
tree | 5260691848ac4fa732e94313bc4a87ef2b1d769d /gcc/ada/einfo.ads | |
parent | 5990d3e7163ff79829cf93524ac90ea3d6d901ec (diff) | |
download | gcc-74cdc0d576479756c7faa88f74b041cd9ff51636.zip gcc-74cdc0d576479756c7faa88f74b041cd9ff51636.tar.gz gcc-74cdc0d576479756c7faa88f74b041cd9ff51636.tar.bz2 |
ada: Missing precondition runtime check in inherited primitive
When a derived tagged type implements interface types in addition
to deriving from its parent type, and a primitive inherited from
its parent type corresponds to an inherited primitive that has
class-wide preconditions, then the generated code fails to check
the class-wide preconditions inherited from the interface primitive.
gcc/ada/ChangeLog:
* einfo.ads (Is_Dispatch_Table_Wrapper): Complete documentation.
* exp_ch6.adb (Install_Class_Preconditions_Check): Dispatch table
wrappers do not require installing the check since it is performed
by the caller.
(Class_Preconditions_Subprogram): Use new predicate Is_LSP_Wrapper.
* freeze.adb (Check_Inherited_Conditions): Rename Postcond_Wrappers to
Condition_Wrappers to handle implicitly inherited subprograms that
implement pre-/postconditions inherited from interface primitives.
Use new predicate Is_LSP_Wrapper.
* sem_disp.adb (Check_Dispatching_Operation): Complete assertion to
handle functions returning class-wide types.
* exp_util.ads (Is_LSP_Wrapper): New subprogram.
* exp_util.adb (Is_LSP_Wrapper): New subprogram.
* contracts.adb (Process_Spec_Postconditions): Use Is_LSP_Wrapper.
(Process_Inherited_Conditions): Use Is_LSP_Wrapper.
* sem_ch6.adb (New_Overloaded_Entity): Use Is_LSP_Wrapper.
* sem_util.adb (Nearest_Class_Condition_Subprogram): Use Is_LSP_Wrapper.
Diffstat (limited to 'gcc/ada/einfo.ads')
-rw-r--r-- | gcc/ada/einfo.ads | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 2fb4570..2aae60a 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -2576,9 +2576,12 @@ package Einfo is -- entity is associated with a dispatch table. -- Is_Dispatch_Table_Wrapper --- Applies to all entities. Set on wrappers built when the subprogram has --- class-wide preconditions or class-wide postconditions affected by --- overriding (AI12-0195). +-- Applies to all entities. Set on wrappers built when a subprogram has +-- class-wide preconditions or postconditions affected by overriding +-- (AI12-0195). Also set on wrappers built when an inherited subprogram +-- implements an interface primitive that has class-wide preconditions +-- or postconditions. In the former case, the entity also has its +-- LSP_Subprogram attribute set. -- Is_Dispatching_Operation -- Defined in all entities. Set for procedures, functions, generic |