From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 8A4F63857BA4 for ; Thu, 14 Sep 2023 12:46:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A4F63857BA4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31c4d5bd69cso841544f8f.3 for ; Thu, 14 Sep 2023 05:46:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1694695575; x=1695300375; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fJUroOD1SQ4eoYSHOEjCSzh9uWrJVy53Yo0MLCg7SuE=; b=TdVO8n77Bcp7WCd+OqNB/lT6Hehw7D7dxYtZFno99WyDH2r9Uku/GYkIYX7R8CatEP TMpevUXpGSPHny168Z32FetZF/8BXOHO7WDrs698UMXcy9zYpFR4RpXMNcQf17tcRmkW LYIAvb25c1cPvczy6+jcFpCjYCINCKuXJ59MjM6mp9zlJcXG7hW4KCdBTYnpQ6gnUZBA XmRnSPq4inQTn849ZTLVj+Z5bMAf9v3oCzCENQCBGRu7uUeNM1xBq0X5TacBZfMv+RI3 /yY4bDDyR3mHdaY+Niu2IUmpxuuO7lvi2EqMe5qw3Z+qcdREm5trCsP6J88HKdlKIRaC Ijfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694695575; x=1695300375; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fJUroOD1SQ4eoYSHOEjCSzh9uWrJVy53Yo0MLCg7SuE=; b=T0rxZS2tzEkGbZH0jhjgrhBHQpAVQIkki5vQ5ypN37nq48Ew31iNyp6/DZJHPYp6UQ p4no56f18TarQSDluo/51g/bCVrUKRlryzxZeBooWl5B/ItA+W+5fdGRR0s5PzCsznOi GWl/IWAcXjOhtA7qEVavU0Q3mhYyMfyw60yBdWB5MvcOYzj/7sDPctjwf1mKpF910LaR 9N1bIIUFPdLYueAvq9HOzDWg0jjzT+QKQHXz5fipT1sk1V54RPo39U0yvNOQ1kPSaKiG BnrCj2wcPlJwYwKPgEkloRAx6zMqa6HXfHI++EPWfWYwqLIiM078ASg3V5ka/RR0VveZ DdFA== X-Gm-Message-State: AOJu0YxC6fm0aKxP4oTR8ATRuvuFbAh2TRhRD6/5VSK1+IeCPagsGcZv y1JsgaMys+1e/+hv870knDoEpXG/VZqwMIhUiJWLcQ== X-Google-Smtp-Source: AGHT+IGGgGXYDzVUSCYdwi4jbF5kenQeVuCYubKh3E0nSa3JQq8bJq1x1r0q+TVEiJioaqHSHGJdIg== X-Received: by 2002:a5d:59c3:0:b0:31f:d15a:2236 with SMTP id v3-20020a5d59c3000000b0031fd15a2236mr2789906wry.15.1694695575314; Thu, 14 Sep 2023 05:46:15 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id z16-20020adfe550000000b0031980294e9fsm1666691wrm.116.2023.09.14.05.46.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 05:46:14 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED] ada: Assertion failure on expansion of record with invariant Date: Thu, 14 Sep 2023 14:46:14 +0200 Message-Id: <20230914124614.1951192-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Javier Miranda gcc/ada/ * exp_util.adb (Process_Record_Component): Adjust assertion on the availablity of the invariant procedure; required because the invariant procedure is built by the expander, and hence it is not available compiling generic units or when the sources have errors, since expansion is then disabled. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.adb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 0dafa1cd6be..5cfadc5245e 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -3324,7 +3324,13 @@ package body Exp_Util is -- if it has invariants of its own or inherits class-wide -- invariants from parent or interface types. - pragma Assert (Present (Proc_Id)); + -- However, given that the invariant procedure is built by + -- the expander, it is not available compiling generic units + -- or when the sources have errors, since expansion is then + -- disabled. + + pragma Assert (Present (Proc_Id) + or else not Expander_Active); -- Generate: -- Invariant (T (_object).); @@ -3333,7 +3339,9 @@ package body Exp_Util is -- assertions are disabled or Assertion_Policy Ignore is in -- effect. - if not Has_Null_Body (Proc_Id) then + if Present (Proc_Id) + and then not Has_Null_Body (Proc_Id) + then Append_New_To (Comp_Checks, Make_Procedure_Call_Statement (Loc, Name => -- 2.40.0