From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00364e01.pphosted.com (mx0b-00364e01.pphosted.com [148.163.139.74]) by sourceware.org (Postfix) with ESMTPS id F3CE83858C62 for ; Wed, 30 Aug 2023 22:15:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3CE83858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=columbia.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=columbia.edu Received: from pps.filterd (m0167074.ppops.net [127.0.0.1]) by mx0b-00364e01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37ULPfQA028378 for ; Wed, 30 Aug 2023 18:15:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=columbia.edu; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type : content-transfer-encoding; s=pps01; bh=/rmn2kvIEcqcPw3y+uuvEzQwDsWlHj3jsPEHxLARrAs=; b=joJmWHzbwoT6d4rxrwfHIOs/Z5V9+mqfkEhqyr2fL3MQUnmqzsZ83VKVoEC4P2lHexXV t5YE4t3q4cLIDrfOVej5HQc/qJMLcJVVL3UXjtAn4WUQ46SHwL6UoupHg3TBSfVsRik5 Vj4Mm4lOj5OMYDSgwf0AE9IUwurF3n8z4Sq2SutiwtuW+PN8IQN1vv+i7VWI2SrQgAoy FqFjcUHyA9ui9NoKnBSVLG2mqJ2YCakRB43oAOwjotM6pxX0ubMAcCpmAayI4khK57O9 zFLrA2TF2pXnaxhQk1F2BeFn4cyIPkWV/pjfcNM1yi0XIQ6CXMJNvhr+i8D1u02AT99F gQ== Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by mx0b-00364e01.pphosted.com (PPS) with ESMTPS id 3sr58r2mua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 30 Aug 2023 18:15:35 -0400 Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-44d4361ce28so150421137.3 for ; Wed, 30 Aug 2023 15:15:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693433734; x=1694038534; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/rmn2kvIEcqcPw3y+uuvEzQwDsWlHj3jsPEHxLARrAs=; b=RUDnA9hbBe3TTqUc8x3lrk40AJKJmnn1uHRL0SAoBZH0lQtiA1BMnlvQr3gxdRIv1d szgNpWr6MG4y1bGJr3LNvo2BmkvrRyxxf7jIsbtuG+o3eIUXF/0s0Oaa48wZY/J6NlYJ DTpu/sM2h+woXEN4NUeMBz3pBHwAp0pktbwonHAS8j+GxxrIgKcC2mSuBeCCfBVbvPx5 hwz9bUaD+jTLfdLnaseeZH49QnsYGxYztf7BG3ZqsXnafsKEjevtD+fRbj8XveUbckne KkdjzVWtZ6T6Q8FhXo95BIXQxpkkBgBFgGuSec8yd2mSG4mMxQDsfirvUC+VJ6HZFSRS UFgQ== X-Gm-Message-State: AOJu0YxH4wDkFOP439xg/nD+ed8UB8sdq9PDp53rMU1Kv38J1KD7h8HJ 7ihYXGs6RdrHhEZSnRpKspc/UEh0Wqs9pNJl7gaET8UKOsnitrRKq6mAqhru/k58gsvlkWfbFVJ KRdOu8l06QZBAq72IO7MQ X-Received: by 2002:a67:bd18:0:b0:44d:4dd6:796b with SMTP id y24-20020a67bd18000000b0044d4dd6796bmr3707635vsq.15.1693433734803; Wed, 30 Aug 2023 15:15:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6mVwyrqeTyBL7IvX7H7P4DAqApZd+yFbW/2p1xQIFMaEIKkxWRUzab6vk/szWBlp4xEPqFgNGPu2yC7DgvOc= X-Received: by 2002:a67:bd18:0:b0:44d:4dd6:796b with SMTP id y24-20020a67bd18000000b0044d4dd6796bmr3707625vsq.15.1693433734544; Wed, 30 Aug 2023 15:15:34 -0700 (PDT) MIME-Version: 1.0 References: <20230829172818.3264-1-ef2648@columbia.edu> In-Reply-To: From: Eric Feng Date: Wed, 30 Aug 2023 18:15:23 -0400 Message-ID: Subject: Re: [PATCH] analyzer: implement reference count checking for CPython plugin [PR107646] To: David Malcolm Cc: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: w32DqqOcqyBWjBEZsD1zgm-4Y26IrWia X-Proofpoint-GUID: w32DqqOcqyBWjBEZsD1zgm-4Y26IrWia X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-30_18,2023-08-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 lowpriorityscore=10 adultscore=0 malwarescore=0 suspectscore=0 impostorscore=10 priorityscore=1501 bulkscore=10 mlxlogscore=999 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308300201 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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: On Tue, Aug 29, 2023 at 5:14=E2=80=AFPM David Malcolm = wrote: > > On Tue, 2023-08-29 at 13:28 -0400, Eric Feng wrote: > > Additionally, by using the old model and the pointer per your > > suggestion, > > we are able to find the representative tree and emit a more accurate > > diagnostic! > > > > rc3.c:23:10: warning: expected =E2=80=98item=E2=80=99 to have reference= count: =E2=80=981=E2=80=99 > > but ob_refcnt field is: =E2=80=982=E2=80=99 > > 23 | return list; > > | ^~~~ > > =E2=80=98create_py_object=E2=80=99: events 1-4 > > | > > | 4 | PyObject* item =3D PyLong_FromLong(3); > > | | ^~~~~~~~~~~~~~~~~~ > > | | | > > | | (1) when =E2=80=98PyLong_FromLong=E2=80= =99 succeeds > > | 5 | PyObject* list =3D PyList_New(1); > > | | ~~~~~~~~~~~~~ > > | | | > > | | (2) when =E2=80=98PyList_New=E2=80=99 s= ucceeds > > |...... > > | 14 | PyList_Append(list, item); > > | | ~~~~~~~~~~~~~~~~~~~~~~~~~ > > | | | > > | | (3) when =E2=80=98PyList_Append=E2=80=99 succeeds, movin= g buffer > > |...... > > | 23 | return list; > > | | ~~~~ > > | | | > > | | (4) here > > | > > Excellent, that's a big improvement. > > > > > If a representative tree is not found, I decided we should just bail > > out > > of emitting a diagnostic for now, to avoid confusing the user on what > > the problem is. > > Fair enough. > > > > > I've attached the patch for this (on top of the previous one) below. > > If > > it also looks good, I can merge it with the last patch and push it in > > at > > the same time. > > I don't mind either way, but please can you update the tests so that we > have some automated test coverage that the correct name is being > printed in the warning. > > Thanks > Dave > Sorry =E2=80=94 forgot to hit 'reply all' in the previous e-mail. Resending= to preserve our chain on the list: --- Thanks; pushed to trunk with nits fixed: https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dcommit;h=3D597b9ec69bca8acb7a3d656= 41c0a730de8b27ed4. Incidentally, I updated my formatting settings in VSCode, which I've previously mentioned in passing. In case anyone is interested: "C_Cpp.clang_format_style": "{ BasedOnStyle: GNU, UseTab: Always, TabWidth: 8, IndentWidth: 2, BinPackParameters: false, AlignAfterOpenBracket: Align, AllowAllParametersOfDeclarationOnNextLine: true }", This fixes some issues with the indent width and also ensures function parameters of appropriate length are aligned properly and on a new line each (like the rest of the analyzer code).