From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id D1667384384B for ; Mon, 13 May 2024 08:35:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1667384384B 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 D1667384384B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715589440; cv=none; b=ioi8eAotE63iecLrzRIp5Tmh1dvdBpdzIXngks5NPKJXLeth1PpK8HJv3HFVBntAlhMbjrUFCFTr/pg2q3eb0mEoUpWD/tOiBjJiwMiewsq+CmwHl6BHmTm/roSp4pcOaKB2SEClyRtHcf3vIE4iTUIsAcBNHyZpNNLVPvGf8hQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715589440; c=relaxed/simple; bh=mW834hFh4YA8mjDUrLo5+UPDBnJ/CRjMzc6RA9gGuJ4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tSipMXCZ9IxjpbktPTiLlXim5/ZytidolumUrWfR/uGeg7R8IDfEfBS16tw5pJ4/pmoZ9tQooLwASPp+tXPBYIHGTLLlRgz3/+cIgujAJeZsbFye39dCL9OicBsdtgsVh0mVIsJDTgLTMU8MysLxbkiKujp9sQhyeOapzKTK7Gs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2e34e85ebf4so33579191fa.2 for ; Mon, 13 May 2024 01:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715589357; x=1716194157; 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=BEczFk7WWk+IRaN502W+aXFBBLgb1tASWyhqIpt2rzI=; b=b7l8sp1f5QRuOVkpAQ/ZHrnx09QlQAiKEyqL4bWdViSDziUUPvn6f9mbE15qCvftbN gIUIgCEb2Oplt5nH8kq8cpPqeo1MbT+k2iAhxjy7dWI91j/ikwpBurUVOESmHaGokr+x oqwUm7nHageoQIvbRRwEnTNOFzV7MoAGtpUBpX4mbr35OFcE3MGhWvn+dpKS41pfx82r hCVAUWDSrrgzMYWW5Yky3qDb2SfUBIi5EVPuD+vPd5rZ8Rl5+FyQ05rlI8ybNs8eSLP4 f0pL63EDP/kZW5djBXCEiJN7EJRl6dHzFbMTqcwkf0XO33oCzHKpiFDg05k0Kx7tZxO1 Qv0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715589357; x=1716194157; 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=BEczFk7WWk+IRaN502W+aXFBBLgb1tASWyhqIpt2rzI=; b=FW1TDB3AJ9/Lr7MqSSbj0vzsTu22TCWzauNNaRv8IEYhXyFECALjlKr/VP6Q7cPR3E MlfycV5lYTkDp/qexMjledtRVMCGXZNDOoB99N5LjqwxDeUIGwEndO/q8eMh3GjlpKgC w8mMRNBAwR7NsU0b8ed6kxa8oM4S8wKjZcmNJ+jMALfjp50FI4V/wNoKR73RZDFtVQ/N t3YxgM/qkMF6ftp49P4HrJsna4mKYArp70Gh28IMuxcZpoaRX31fdV7V25XRlQdCY1+b o6tkNw17UOSqvTTScu1GUjicx06ZeTRcaPnfscmbfcmx0OHAsyZVQ6e2GnhW0Or5Shzk 9T4w== X-Gm-Message-State: AOJu0YwdoxPx5+7bF1sDjoyxkgIczkWmpF5cyGVORnGtJjDWn40bsBMk lOp69dXfUyBYD+OQLuDbNKRxsGEC7z4YwLyde/5nhB96sZqYXA5V4s1Zgx/SYpDNb1zGivuZkLQ = X-Google-Smtp-Source: AGHT+IHt/FV6RwKYhmPX8/rlOH8oUSy2DlREPDe7Kequ6EcRsEhPZtGoaS+mDGJiqgPjnbVXWbJsYw== X-Received: by 2002:a2e:9dc3:0:b0:2e2:72a7:843f with SMTP id 38308e7fff4ca-2e52028ae76mr51265691fa.35.1715589356401; Mon, 13 May 2024 01:35:56 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:cf0f:cd6c:7a6a:cbed]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42013b4e9aesm43266655e9.40.2024.05.13.01.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 01:35:56 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Avoid crash on illegal constrained type declarations Date: Mon, 13 May 2024 10:35:55 +0200 Message-ID: <20240513083555.164842-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.9 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: Piotr Trojanek Fix crash on ACATS test B38003B introduced by a recent cleanup of per-object constraints. gcc/ada/ * sem_util.adb (Get_Index_Bounds): Guard against missing Entity, which happens on illegal constrained type declaration. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 5f44b4c26fe..579172515df 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -10542,7 +10542,10 @@ package body Sem_Util is H := High_Bound (Range_Expression (Constraint (N))); end if; - elsif Is_Entity_Name (N) and then Is_Type (Entity (N)) then + elsif Is_Entity_Name (N) + and then Present (Entity (N)) + and then Is_Type (Entity (N)) + then Rng := Scalar_Range_Of_Type (Entity (N)); if Error_Posted (Rng) then -- 2.43.2