* [COMMITTED] ada: Change local variables to constants in expansion of packed arrays
@ 2023-11-07 9:19 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-11-07 9:19 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
Cleanup; semantics is unaffected.
gcc/ada/
* exp_pakd.adb
(Expand_Bit_Packed_Element_Set): Change local Decl object from
variable to constant.
(Setup_Inline_Packed_Array_Reference): Likewise for Csiz.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_pakd.adb | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index 2d3abbd349d..1641e8a51c2 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -1137,14 +1137,12 @@ package body Exp_Pakd is
if Nkind (Rhs) = N_String_Literal then
declare
- Decl : Node_Id;
- begin
- Decl :=
+ Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Temporary (Loc, 'T', Rhs),
Object_Definition => New_Occurrence_Of (Ctyp, Loc),
Expression => New_Copy_Tree (Rhs));
-
+ begin
Insert_Actions (N, New_List (Decl));
Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc);
end;
@@ -2481,12 +2479,10 @@ package body Exp_Pakd is
Loc : constant Source_Ptr := Sloc (N);
PAT : Entity_Id;
Otyp : Entity_Id;
- Csiz : Uint;
+ Csiz : constant Uint := Component_Size (Atyp);
Osiz : Uint;
begin
- Csiz := Component_Size (Atyp);
-
Convert_To_PAT_Type (Obj);
PAT := Etype (Obj);
--
2.42.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-07 9:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 9:19 [COMMITTED] ada: Change local variables to constants in expansion of packed arrays Marc Poulhiès
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).