public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1627] [Ada] Error issued on string literal assigned to fixed-lower-bound array Date: Fri, 18 Jun 2021 08:39:00 +0000 (GMT) [thread overview] Message-ID: <20210618083900.E39B139B4421@sourceware.org> (raw) https://gcc.gnu.org/g:f44441d80fa8523a2e1b294b8563180202879727 commit r12-1627-gf44441d80fa8523a2e1b294b8563180202879727 Author: Gary Dismukes <dismukes@adacore.com> Date: Thu Mar 18 20:23:04 2021 -0400 [Ada] Error issued on string literal assigned to fixed-lower-bound array gcc/ada/ * exp_util.adb (Expand_Sliding_Conversion): Move test of Is_Fixed_Lower_Bound_Subtype to an assertion. Exclude string literals from sliding expansion. Diff: --- gcc/ada/exp_util.adb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 19b8c656e2c..ed1a016be48 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -5323,7 +5323,8 @@ package body Exp_Util is procedure Expand_Sliding_Conversion (N : Node_Id; Arr_Typ : Entity_Id) is pragma Assert (Is_Array_Type (Arr_Typ) - and then not Is_Constrained (Arr_Typ)); + and then not Is_Constrained (Arr_Typ) + and then Is_Fixed_Lower_Bound_Array_Subtype (Arr_Typ)); Constraints : List_Id; Index : Node_Id := First_Index (Arr_Typ); @@ -5342,7 +5343,10 @@ package body Exp_Util is All_FLBs_Match : Boolean := True; begin - if Is_Fixed_Lower_Bound_Array_Subtype (Arr_Typ) then + -- Sliding should never be needed for string literals, because they have + -- their bounds set according to the applicable index constraint. + + if Nkind (N) /= N_String_Literal then Constraints := New_List; Act_Subt := Get_Actual_Subtype (N);
reply other threads:[~2021-06-18 8:39 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=20210618083900.E39B139B4421@sourceware.org \ --to=pmderodat@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).