public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-967] Fix internal error on locally derived bit-packed array type Date: Fri, 21 May 2021 08:58:08 +0000 (GMT) [thread overview] Message-ID: <20210521085808.933F63857C44@sourceware.org> (raw) https://gcc.gnu.org/g:dd9a8fff14eda90fcaa3ac4b6b68ceded72a6af5 commit r12-967-gdd9a8fff14eda90fcaa3ac4b6b68ceded72a6af5 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Fri May 21 10:57:02 2021 +0200 Fix internal error on locally derived bit-packed array type This is a regression present on the mainline, 11 and 10 branches, in the form of an ICE on a locally derived bit-packed array type. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Process the implementation type of a packed type implemented specially. gcc/testsuite/ * gnat.dg/derived_type7.adb, gnat.dg/derived_type7.ads: New test. Diff: --- gcc/ada/gcc-interface/decl.c | 14 +++++++++----- gcc/testsuite/gnat.dg/derived_type7.adb | 9 +++++++++ gcc/testsuite/gnat.dg/derived_type7.ads | 13 +++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 19e851ff712..8d3c16c624b 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2345,11 +2345,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) set_nonaliased_component_on_array_type (tem); } - /* If an alignment is specified, use it if valid. But ignore it - for the original type of packed array types. If the alignment - was requested with an explicit alignment clause, state so. */ - if (No (Packed_Array_Impl_Type (gnat_entity)) - && Known_Alignment (gnat_entity)) + /* If this is a packed type implemented specially, then process the + implementation type so it is elaborated in the proper scope. */ + if (Present (Packed_Array_Impl_Type (gnat_entity))) + gnat_to_gnu_entity (Packed_Array_Impl_Type (gnat_entity), NULL_TREE, + false); + + /* Otherwise, if an alignment is specified, use it if valid and, if + the alignment was requested with an explicit clause, state so. */ + else if (Known_Alignment (gnat_entity)) { SET_TYPE_ALIGN (tem, validate_alignment (Alignment (gnat_entity), diff --git a/gcc/testsuite/gnat.dg/derived_type7.adb b/gcc/testsuite/gnat.dg/derived_type7.adb new file mode 100644 index 00000000000..61e7abaa1d7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/derived_type7.adb @@ -0,0 +1,9 @@ +package body Derived_Type7 is + + procedure Proc (Size : Natural) is + type Sar_Six_Bit_Arr is new Six_Bit_Data_Array_Type (1 .. Size); + begin + null; + end; + +end Derived_Type7; diff --git a/gcc/testsuite/gnat.dg/derived_type7.ads b/gcc/testsuite/gnat.dg/derived_type7.ads new file mode 100644 index 00000000000..2b1427af3c6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/derived_type7.ads @@ -0,0 +1,13 @@ +-- { dg-do compile } + +package Derived_Type7 is + + type Six_Bit_Data_Type is range 0 .. 63; + for Six_Bit_Data_Type'Size use 6; + + type Six_Bit_Data_Array_Type is array (Integer range <>) of Six_Bit_Data_Type; + for Six_Bit_Data_Array_Type'Component_Size use 6; + + procedure Proc (Size : Natural); + +end Derived_Type7;
reply other threads:[~2021-05-21 8:58 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=20210521085808.933F63857C44@sourceware.org \ --to=ebotcazou@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).