diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-10-03 21:33:32 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-11-07 10:15:02 +0100 |
commit | aeca5b9554d816a8ef8afd0f6cd99250a0a67979 (patch) | |
tree | df41e49296cda29b27472ff11b18132ab3e14e87 | |
parent | 9eb5deb42b1dffe030d447913191a615bba90284 (diff) | |
download | gcc-aeca5b9554d816a8ef8afd0f6cd99250a0a67979.zip gcc-aeca5b9554d816a8ef8afd0f6cd99250a0a67979.tar.gz gcc-aeca5b9554d816a8ef8afd0f6cd99250a0a67979.tar.bz2 |
ada: Avoid extra conversion in expansion of packed array assignments
Expansion of assignments to packed array objects with string literals on
the right-hand side, created an unnecessary conversion, i.e.:
... :=
component_type
(declare
temp : component_type := "string_literal";
begin
temp)
Now the expansion omits the outer type conversion.
Cleanup; behavior is unaffected.
gcc/ada/
* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Simplify handling of
assignments with string literals.
-rw-r--r-- | gcc/ada/exp_pakd.adb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index ef0ec1e..e197211 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -1143,9 +1143,10 @@ package body Exp_Pakd is Insert_Actions (N, New_List (Decl)); Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc); end; + else + Rhs := Convert_To (Ctyp, Rhs); end if; - Rhs := Convert_To (Ctyp, Rhs); Set_Parent (Rhs, N); -- If we are building the initialization procedure for a packed array, |