From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [Ada] Cleanup in Convert_To_Positional after previous work
Date: Wed, 15 Jul 2020 09:45:19 -0400 [thread overview]
Message-ID: <20200715134519.GA23799@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
This adjusts the description of Flatten, removes an obsolete comment
and uses Compile_Time_Known_Value as now done in Is_Static_Element.
No functional changes.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_aggr.adb (Flatten): Adjust description.
(Convert_To_Positional): Remove obsolete ??? comment and use
Compile_Time_Known_Value in the final test.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 2038 bytes --]
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -4969,9 +4969,8 @@ package body Exp_Aggr is
Dims : Nat;
Ix : Node_Id;
Ixb : Node_Id) return Boolean;
- -- Convert the aggregate into a purely positional form if possible. On
- -- entry the bounds of all dimensions are known to be static, and the
- -- total number of components is safe enough to expand.
+ -- Convert the aggregate into a purely positional form if possible after
+ -- checking that the bounds of all dimensions are known to be static.
function Is_Flat (N : Node_Id; Dims : Nat) return Boolean;
-- Return True if the aggregate N is flat (which is not trivial in the
@@ -5476,10 +5475,6 @@ package body Exp_Aggr is
-- compatible with the upper bound of the type, and therefore it is
-- worth flattening such aggregates as well.
- -- For now the back-end expands these aggregates into individual
- -- assignments to the target anyway, but it is conceivable that
- -- it will eventually be able to treat such aggregates statically???
-
if Aggr_Size_OK (N, Typ)
and then
Flatten (N, Dims, First_Index (Typ), First_Index (Base_Type (Typ)))
@@ -5506,14 +5501,7 @@ package body Exp_Aggr is
if Nkind (N) = N_Aggregate and then Present (Expressions (N)) then
Expr := First (Expressions (N));
while Present (Expr) loop
- if Nkind_In (Expr, N_Integer_Literal, N_Real_Literal)
- or else
- (Is_Entity_Name (Expr)
- and then Ekind (Entity (Expr)) = E_Enumeration_Literal)
- then
- null;
-
- else
+ if not Compile_Time_Known_Value (Expr) then
Error_Msg_N
("non-static object requires elaboration code??", N);
exit;
reply other threads:[~2020-07-15 13:45 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=20200715134519.GA23799@adacore.com \
--to=derodat@adacore.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@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: link
Be 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).