public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [Ada] Fix crash for Default_Initial_Condition on derived enumeration type
Date: Mon, 5 Sep 2022 09:25:54 +0200	[thread overview]
Message-ID: <20220905072554.GA1174542@poulhies-Precision-5550> (raw)

[-- Attachment #1: Type: text/plain, Size: 1582 bytes --]

This fixes a crash on the declaration of a private derived enumeration type
with the Default_Initial_Condition aspect and in the process makes a couple
of related adjustments: 1) removes the early freezing of implicit character
and numeric base types and 2) fixes an oversight in the implementation of
delayed representation aspects.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* aspects.ads (Delaying Evaluation of Aspect): Fix typos.
	* exp_ch3.adb (Freeze_Type): Do not generate Invariant and DIC
	procedures for internal types.
	* exp_util.adb (Build_DIC_Procedure_Body): Adjust comment.
	* freeze.adb (Freeze_Entity): Call Inherit_Delayed_Rep_Aspects for
	subtypes and derived types only after the base or parent type has
	been frozen.  Remove useless freezing for first subtype.
	(Freeze_Fixed_Point_Type): Call Inherit_Delayed_Rep_Aspects too.
	* layout.adb (Set_Elem_Alignment): Deal with private types.
	* sem_ch3.adb (Build_Derived_Enumeration_Type): Build the implicit
	base as an itype and do not insert its declaration in the tree.
	(Build_Derived_Numeric_Type): Do not freeze the implicit base.
	(Derived_Standard_Character): Likewise.
	(Constrain_Enumeration): Inherit the chain of representation items
	instead of replacing it.
	* sem_ch13.ads (Inherit_Aspects_At_Freeze_Point): Add ??? comment.
	(Inherit_Delayed_Rep_Aspects): Declare.
	* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Do not invoke
	Inherit_Delayed_Rep_Aspects.
	(Inherit_Aspects_At_Freeze_Point): Deal with private types.
	(Inherit_Delayed_Rep_Aspects): Move to library level.

[-- Attachment #2: patch.diff.gz --]
[-- Type: application/gzip, Size: 7280 bytes --]

                 reply	other threads:[~2022-09-05  7:25 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=20220905072554.GA1174542@poulhies-Precision-5550 \
    --to=poulhies@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).