From patchwork Mon Nov 1 22:15:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 46929 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CDA57385802B for ; Mon, 1 Nov 2021 22:16:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDA57385802B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635804968; bh=e1R7bVgkC24E4MoPByCxfsdGOr3Jb+zd81Npbg6/pUY=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=f4USHTiTngPOdX26MATdoZ0GHPnU+8vMIAk8+dgEvKsgcODxBeJlA/s0GWsJJpfBY NZgx0oZA/XwbDITODIrFCfp4GJnrd2763fcPa8ByUSWRIMoeD5uGBDXg+Jybr1LSP4 4FaazlHxMbnNjwTSVuXA7AFNgGv7eA9f2W/iAom4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by sourceware.org (Postfix) with ESMTPS id 4C03F3858403 for ; Mon, 1 Nov 2021 22:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4C03F3858403 Received: by mail-qt1-x82d.google.com with SMTP id j1so10054408qtq.11 for ; Mon, 01 Nov 2021 15:15:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=e1R7bVgkC24E4MoPByCxfsdGOr3Jb+zd81Npbg6/pUY=; b=zkf4O2VJNyA97jsS8W4Un71ZTPDiHAQVamGVL3cFYtiBX37zXsYIXIpCVTkdhTI1nE EN/zHp+PbI1/Cna1pwi+G4SXT0uZSh/meSgTaCCSSOLxMM+0k6TeXnGemScNXzTn77cK ZbxdmQ5/0nn8W1A5Up4owNQVA6iMkwdpOC78csLPm+hMBhKqVGkiichLDQ9DD7bfV4XQ P8xvmCoxrxwnXEtZpA20wDykO4mdhQPuH1Rt+/xL5KsZqmsYbdzuhiQ/SwJWFujRG8TY omTYHGajOGQpP7pEqygxkl5ijOD2DQSueHTKwjsSipfQmIVkgPvg9RAMM5xTjP7ZRlpd I81w== X-Gm-Message-State: AOAM532ciLl9Clu1baNbqiJhyvPg09NQLq+61IgdXEMC9n9QyYQZ5UC3 V0NkP8j3wU2VdC0wVC6UA5s= X-Google-Smtp-Source: ABdhPJwO3yRWqAsvzD5+c3B9XwF2q7b7CDaE2igTktuZEEjbpfYA9zcMxGb1BvRNc+HM29ESIe3kSw== X-Received: by 2002:ac8:5e12:: with SMTP id h18mr12826007qtx.168.1635804938940; Mon, 01 Nov 2021 15:15:38 -0700 (PDT) Received: from [192.168.0.41] (184-96-250-76.hlrn.qwest.net. [184.96.250.76]) by smtp.gmail.com with ESMTPSA id p187sm10777883qkd.101.2021.11.01.15.15.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Nov 2021 15:15:38 -0700 (PDT) Subject: [PATCH 0/2] provide simple detection of indeterminate pointers To: gcc-patches Message-ID: Date: Mon, 1 Nov 2021 16:15:37 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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: Martin Sebor via Gcc-patches From: Martin Sebor Reply-To: Martin Sebor Cc: Martin Sebor Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This two-patch series adds support for the detection of uses of pointers invalidated as a result of the lifetime of the objects they point to having ended: either explicitly, after a call to a dynamic deallocation function, or implicitly, by virtue of an object with automatic storage duration having gone out of scope. To minimize false positives the initial logic is very simple (even simplistic): the code only checks uses in basic blocks dominated by the invalidating calls (either calls to deallocation functions or GCC's clobbers). A more thorough checker is certainly possible and I'd say most desirable but will require a more sophisticated implementation and a better predicate analyzer than is available, and so will need to wait for GCC 13. Martin