From patchwork Fri Jun 21 08:58:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1950650 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=KqnlKrSG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W5BHQ0L7jz1ydW for ; Fri, 21 Jun 2024 19:04:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 589713896C2C for ; Fri, 21 Jun 2024 09:04:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 3F0D23896C1F for ; Fri, 21 Jun 2024 08:58:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F0D23896C1F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3F0D23896C1F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960323; cv=none; b=sU26aqGSx5/nBkBKpKr8AIbyQVtvJkodBTMGGLeNHmfz3dXB5MEknfNsC3q1gz6FR7iZIp9TIyKk/pwzWffnADdn4AJD+skGlrF3kZxp3gsd8RgydxCuXO3gKClGIumPH13gXBkm2L5hvCW3APvlxRKq1HvEf4ozPSw4PYyhTrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960323; c=relaxed/simple; bh=o/JjLgJ934d58CeAq6Y+5JWkOYcPUE1P23YZ+WiRAFM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=L54hIW1hNntmCcYosp9B271OhLK6Hp9ExJJMmY1vMVG4yydaEfNeba5Bk1HrcEMLwlbD5Tbkqy2uEQBATk4YUoXvtJmsM1+kYdZpTO/mhk2oa4Yb4m9m5O3vTKJLmu9I+mIx06CHo0ss5aohnVRbA0+z7YnPPMptckC03k0nYRc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42108856c33so17233665e9.1 for ; Fri, 21 Jun 2024 01:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718960321; x=1719565121; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cZKPS+17C7kFnfadiScBJABtQ1xYPAikZmNk9Bbp9xo=; b=KqnlKrSGoFH4907nxTkfnkJM2LbDYBM9UroatWZfDH+3BKczeRSUhQ2DvtUYjNl2lO rBmJrzW79IUGizYQ5eRAXMj1sovUSjSYKJksF9czBQ21bx4bt+/6YprotY0kPe/Z2JIG p5FbnimPMismEQoaUDbuEp6+WZcoe0uJlAqgOY4yF300AzpUL3yoY7J1UbgbW2TFKpdW 62+Sm1NLSsxQvPO/eMgp9Va9zi7GK2UJ368SToY+JDGF7SsZoJP1FEMZpbc840p/7ejU CprpajkTX9W02tVFcHxnBEcOm789pvC9ngKWHBt5nV7r9ahyJrQ95fFAMt2SJ4JLYTpw c+GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718960321; x=1719565121; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cZKPS+17C7kFnfadiScBJABtQ1xYPAikZmNk9Bbp9xo=; b=Ff2av6IijIGODZs9zmNzFx3HJg356Enj9lxCvb/lr2JLGaC19Lc2cLZdjGiua9AWuj q/MHkvzK9le7SGbVpCN/wDfsSKdF3MxHEOqIWKFpwP1y0KZ2UaVPswH3YisrJs+4vXL3 75dwj3dQLJcqoqiouZpNggp0ZATIgm8BUx7n/mb6XDGK4LKVLG4f2ojOzHRd80bfxEoj b1lGcKe5WlrRLlYW2e1NZYlEtjGKHXDkDUIuB0OaFN4Mu3huHxYXcT2ahLUp6+Tp4kxo evqUEilxasJa+4nfd4RjHwAKDP7aSWwmZqCnpZdvMCNKuHqoNwjC42GwgCrw4JaS3WKN nmUA== X-Gm-Message-State: AOJu0YwjpT6pkjWmpNCytJn6PUM2FDX1qdTfq8usFuv3lR0CpPuPRyuu TBCcn6cVne3uVN+9WhxNGHwkJHX0AqbzyvR0cdgZ/zEHjC+WuATQ+5X7ZU2i7mdy5ZVJtOHQ1rQ = X-Google-Smtp-Source: AGHT+IEafiixBNXSUlmRk86+uzEhIjdI+4gMJ6COm1RMyTANdptEgYS8n5467MWEVtEmqeTMVayL6g== X-Received: by 2002:a05:600c:364d:b0:424:84fb:9fd2 with SMTP id 5b1f17b1804b1-42484fba09amr1285455e9.19.1718960320961; Fri, 21 Jun 2024 01:58:40 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:a589:2704:bfe1:5d92]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d0c5485sm55322375e9.21.2024.06.21.01.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 01:58:40 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED 14/22] ada: Crash when using user defined string literals Date: Fri, 21 Jun 2024 10:58:10 +0200 Message-ID: <20240621085819.2485987-14-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621085819.2485987-1-poulhies@adacore.com> References: <20240621085819.2485987-1-poulhies@adacore.com> MIME-Version: 1.0 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Javier Miranda When a non-overridable aspect is explicitly specified for a non-tagged derived type, the compiler blows up processing an object declaration of an object of such type. gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Fix code locating the entity of the parent type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch13.adb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index a86f774018a..90376f818a3 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -4801,8 +4801,14 @@ package body Sem_Ch13 is and then Nkind (Type_Definition (N)) = N_Derived_Type_Definition and then not In_Instance_Body then + -- In order to locate the parent type we must go first to its + -- base type because the frontend introduces an implicit base + -- type even if there is no constraint attached to it, since + -- this is closer to the Ada semantics. + declare - Parent_Type : constant Entity_Id := Etype (E); + Parent_Type : constant Entity_Id := + Etype (Base_Type (E)); Inherited_Aspect : constant Node_Id := Find_Aspect (Parent_Type, A_Id); begin