public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1259] ada: Fix another couple of unchecked conversions to Ada.Tags.Tag Date: Fri, 26 May 2023 07:35:27 +0000 (GMT) [thread overview] Message-ID: <20230526073527.7AA083857835@sourceware.org> (raw) https://gcc.gnu.org/g:d6dcb41d8f402ae356cb0890598d77c22c42fb21 commit r14-1259-gd6dcb41d8f402ae356cb0890598d77c22c42fb21 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Wed Mar 15 13:56:33 2023 +0100 ada: Fix another couple of unchecked conversions to Ada.Tags.Tag They are problematic on platforms where the provenance of pointers must be tracked throughout their lifetime. gcc/ada/ * exp_sel.adb: Add clauses for Sem_Util, remove them for Opt, Sinfo and Sinfo.Nodes. (Build_K): Always use 'Tag of the object. (Build_S_Assignment): Likewise. Diff: --- gcc/ada/exp_sel.adb | 71 +++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 54 deletions(-) diff --git a/gcc/ada/exp_sel.adb b/gcc/ada/exp_sel.adb index 66019be8e58..39ebb91139d 100644 --- a/gcc/ada/exp_sel.adb +++ b/gcc/ada/exp_sel.adb @@ -27,10 +27,8 @@ with Einfo; use Einfo; with Einfo.Entities; use Einfo.Entities; with Nlists; use Nlists; with Nmake; use Nmake; -with Opt; use Opt; with Rtsfind; use Rtsfind; -with Sinfo; use Sinfo; -with Sinfo.Nodes; use Sinfo.Nodes; +with Sem_Util; use Sem_Util; with Snames; use Snames; with Stand; use Stand; with Tbuild; use Tbuild; @@ -151,18 +149,12 @@ package body Exp_Sel is Obj : Entity_Id) return Entity_Id is K : constant Entity_Id := Make_Temporary (Loc, 'K'); - Tag_Node : Node_Id; + Tag_Node : constant Node_Id := + Make_Attribute_Reference (Loc, + Prefix => New_Copy_Tree (Obj), + Attribute_Name => Name_Tag); begin - if Tagged_Type_Expansion then - Tag_Node := Unchecked_Convert_To (RTE (RE_Tag), Obj); - else - Tag_Node := - Make_Attribute_Reference (Loc, - Prefix => Obj, - Attribute_Name => Name_Tag); - end if; - Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => K, @@ -172,6 +164,7 @@ package body Exp_Sel is Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Tagged_Kind), Loc), Parameter_Associations => New_List (Tag_Node)))); + return K; end Build_K; @@ -202,48 +195,18 @@ package body Exp_Sel is Obj : Entity_Id; Call_Ent : Entity_Id) return Node_Id is - Typ : constant Entity_Id := Etype (Obj); - begin - if Tagged_Type_Expansion then - return - Make_Assignment_Statement (Loc, - Name => New_Occurrence_Of (S, Loc), - Expression => - Make_Function_Call (Loc, - Name => New_Occurrence_Of (RTE (RE_Get_Offset_Index), Loc), - Parameter_Associations => New_List ( - Unchecked_Convert_To (RTE (RE_Tag), Obj), - Make_Integer_Literal (Loc, DT_Position (Call_Ent))))); - - -- VM targets - - else - return - Make_Assignment_Statement (Loc, - Name => New_Occurrence_Of (S, Loc), - Expression => - Make_Function_Call (Loc, - Name => New_Occurrence_Of (RTE (RE_Get_Offset_Index), Loc), - - Parameter_Associations => New_List ( - - -- Obj_Typ - - Make_Attribute_Reference (Loc, - Prefix => Obj, - Attribute_Name => Name_Tag), - - -- Iface_Typ - - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (Typ, Loc), - Attribute_Name => Name_Tag), - - -- Position - - Make_Integer_Literal (Loc, DT_Position (Call_Ent))))); - end if; + return + Make_Assignment_Statement (Loc, + Name => New_Occurrence_Of (S, Loc), + Expression => + Make_Function_Call (Loc, + Name => New_Occurrence_Of (RTE (RE_Get_Offset_Index), Loc), + Parameter_Associations => New_List ( + Make_Attribute_Reference (Loc, + Prefix => New_Copy_Tree (Obj), + Attribute_Name => Name_Tag), + Make_Integer_Literal (Loc, DT_Position (Call_Ent))))); end Build_S_Assignment; end Exp_Sel;
reply other threads:[~2023-05-26 7:35 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230526073527.7AA083857835@sourceware.org \ --to=dkm@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).