* [COMMITTED] ada: Fix internal error on address of element of packed array component
@ 2023-11-07 9:18 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-11-07 9:18 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
This occurs when the component is part of a discriminated type and its
offset depends on a discriminant, the problem being that the front-end
generates an incomplete Bit_Position attribute reference.
gcc/ada/
* exp_pakd.adb (Get_Base_And_Bit_Offset): Use the full component
reference instead of just the selector name for 'Bit_Position.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_pakd.adb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index c3908a54538..ad12aec1e23 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -2112,8 +2112,8 @@ package body Exp_Pakd is
-- We build up an expression serially that has the form
- -- linear-subscript * component_size for each array reference
- -- + field'Bit_Position for each record field
+ -- linear-subscript * component_size for each array component ref
+ -- + pref.component'Bit_Position for each record component ref
-- + ...
loop
@@ -2135,7 +2135,7 @@ package body Exp_Pakd is
elsif Nkind (Base) = N_Selected_Component then
Term :=
Make_Attribute_Reference (Loc,
- Prefix => Selector_Name (Base),
+ Prefix => Base,
Attribute_Name => Name_Bit_Position);
else
--
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:18 [COMMITTED] ada: Fix internal error on address of element of packed array component 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).