From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 927D53857831 for ; Thu, 27 May 2021 17:40:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 927D53857831 Received: by mail-pg1-x536.google.com with SMTP id t193so481114pgb.4 for ; Thu, 27 May 2021 10:40:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=eBFgPE2s4dlXtTLPvU5G/1zmAtZKHY/ctFKrHm8bcKE=; b=JrwXmmEVd2PNwAkTSQhMQXYh/U1dFNqW3K0+/ci7UTGgxHIZYSJxPD/Xee3cOu9z/d ocsxyAk7jmn+gsLJyjADisio3pOsYrYh9uB6o0I44Sm7QDRs9KiEq+mmaa4C3dXomR9X 2ckbR51XgUg02SofwM3OblZUZ9utoXKDgq+wk0rhag0E0NqWxdYKVnvWfGm1q/vS5Hza s3D1EoQCr1meW5SDzvF+PeOzOJw3RqGp1NaNOAzopjedUgFmGRTyI9dtdixfKhbbRhhZ iC/gGJpA4WrLljloDg499CfmpL8FElCmKbtGQg0nqTvnhdhUb3Hpu7U5NJfX7OHbzQd1 aqBA== X-Gm-Message-State: AOAM530fhXih5MJbQgdQMQjeXKa9v3/BjbH9xFIUmTV2bD/bbikld8nn KcrUqOXtQnEcb0QnXWHbseEUj68FnE6qrQ== X-Google-Smtp-Source: ABdhPJw7RfrfuBz7n6AriH1JGhGT34k491ybdDUtV1Z3qTx2BINN1pU+5NC37smYofWu/7GpUH/8Kg== X-Received: by 2002:a63:2307:: with SMTP id j7mr4755039pgj.20.1622137238414; Thu, 27 May 2021 10:40:38 -0700 (PDT) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id c20sm2449614pjr.35.2021.05.27.10.40.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 May 2021 10:40:37 -0700 (PDT) Subject: Re: [PATCH] handle erroneous types in attribute nonnull (PR 100783) To: Martin Sebor , gcc-patches References: <40750f8b-89be-a3a1-2279-f912d499382f@gmail.com> From: Jeff Law Message-ID: <494b353b-7c24-ecd2-fba3-c56b58a1e0af@gmail.com> Date: Thu, 27 May 2021 11:40:36 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <40750f8b-89be-a3a1-2279-f912d499382f@gmail.com> Content-Language: en-US X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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-List-Received-Date: Thu, 27 May 2021 17:40:41 -0000 On 5/27/2021 10:00 AM, Martin Sebor via Gcc-patches wrote: > When attribute nonnull is applied to an argument of an erroneous > type the attribute positional argument validation function ICEs > while printing a warning that mentions the invalid type. > > The attached patch changes the validation function to ignore > erroneous types on the assumption that they must have already > been diagnosed.  It also enhances the pretty-printer to detect > erroneous types and print "{erroneous}" instead of causing > an ICE.  There already is code in the pretty printer that tries > to be robust in thew presence of erroneous types without actually > printing them, and this extends the detection to also print them. > (With the first part of this patch I don't have a test case for > it but handling the condition gracefully feels preferable to > waiting for another bug report with invalid code triggering > an ICE). > > Martin > > gcc-100783.diff > > PR c/100783 - ICE on -Wnonnull and erroneous type > > gcc/c-family/ChangeLog: > > PR c/100783 > * c-attribs.c (positional_argument): Bail on erroneous types. > > gcc/c/ChangeLog: > > PR c/100783 > * c-objc-common.c (print_type): Handle erroneous types. > > gcc/testsuite/ChangeLog: > > PR c/100783 > * gcc.dg/nonnull-6.c: New test. OK jeff