From patchwork Wed Oct 20 19:27:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1544021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=OT4/YpJF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HZLQ11wZkz9sNH for ; Thu, 21 Oct 2021 06:33:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0A3033858025 for ; Wed, 20 Oct 2021 19:33:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A3033858025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1634758423; bh=Ffb5O3BPF1A+w7nWYkK2J3S+cWwHzDVkP/egZpNkz28=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=OT4/YpJFc0XOikR3CHg7zXMush9XZ4kOTgWD13JTRDyJIOzetBP31ItbEhwnefaPO BpGcPzBs5Yl0gaCep7MiW56N2fC0xTuEbgOSoTXMi+CumzJb/eZRLmkqfYxgcDQ7jm KeaUZSJKY+1spAwjEFtWDES8Kxhx3ZA45BsYU/NQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id C5ADC3857C56 for ; Wed, 20 Oct 2021 19:27:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C5ADC3857C56 Received: by mail-lj1-x231.google.com with SMTP id u5so580132ljo.8 for ; Wed, 20 Oct 2021 12:27:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Ffb5O3BPF1A+w7nWYkK2J3S+cWwHzDVkP/egZpNkz28=; b=ePwGNdB06apwFDAXHXyydRJi0eEuKVh4PJN/X6e33c2ytIlPMK+FYw5CzQgslnbds4 RgfcduGsSuFR/mZGj+yZndIqg5Lg+9wat761NNtnQNHDCqJE31bCxrE06cbSI2NVAn0Z soQ1FYk8+BhA3UUpYcoC5vimPHXp43+IgJnDGegj5CeW/4hKz41qlbpiXJAN6rVgr52x v37i6OT1eqkTilZb9lRz1PgQ12pMgu/KvCTypoAizRGSkB82FfUSQnx0F8K2oIqaQo9D dKVZwRGHcvHmDMBq6qojeNF6NEEIFUBlEciUvPl8y5BL2lUsaUe+MoSom2/S5L8mrHoq UzQQ== X-Gm-Message-State: AOAM532rZnPq6REGs4C8Bw25f+d6NsJfdakgrPjT66mpEqYG718Dyc6+ i0S/2+/wB7RjS2qoJFMoBMmxBtQ1XuBQLuki X-Google-Smtp-Source: ABdhPJxSokGgOd/pYX2qnJ+FwLP6VLKfNfZ/RjEUbK6JKGhTb+vaL2V00uGOMSxiKXtE2mNSqtlUMg== X-Received: by 2002:a2e:8008:: with SMTP id j8mr953815ljg.437.1634758060650; Wed, 20 Oct 2021 12:27:40 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id r14sm263749lfe.13.2021.10.20.12.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 12:27:39 -0700 (PDT) Date: Wed, 20 Oct 2021 19:27:38 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Prevent use of an uninitialized AST field with universal integer Message-ID: <20211020192738.GA3154162@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" A temporary workaround needed by GNATprove after cleaning up the handling of AST fields with universal integers. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Guard against equality of an uninitialized RM_Size field. diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb --- a/gcc/ada/exp_spark.adb +++ b/gcc/ada/exp_spark.adb @@ -451,6 +451,7 @@ package body Exp_SPARK is Apply_Universal_Integer_Attribute_Checks (N); if Present (Typ) + and then Known_RM_Size (Typ) and then RM_Size (Typ) = RM_Size (Standard_Long_Long_Integer) then -- ??? This should rather be a range check, but this would