From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 40AAD3858CDB for ; Sun, 2 Apr 2023 23:15:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40AAD3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680477301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+C2/7UZtSEgB/cQMMGUomci6eV76ZFTu+xoX7haOyeA=; b=FXqU2nL60QcRnrlb+u1Mw59TxyaIjZfsWe7qXHU/FWegiadM2itVmZMBn4fnqIshWcW8T9 JEjG1LTIKsFBr776xeWsE0L+ukFc6U0gMQmTxWxrc94z8RavOsvqal9pRU10J6nAxEBmHP bEZRCXpF85YPl+JTOCNnFEGyN7wXzZw= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-1HC3zRPDPU6p9x1sqI6j2g-1; Sun, 02 Apr 2023 19:15:00 -0400 X-MC-Unique: 1HC3zRPDPU6p9x1sqI6j2g-1 Received: by mail-qt1-f197.google.com with SMTP id e4-20020a05622a110400b003e4e915a164so14330504qty.4 for ; Sun, 02 Apr 2023 16:15:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680477300; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+C2/7UZtSEgB/cQMMGUomci6eV76ZFTu+xoX7haOyeA=; b=t9LAz3WnkqIAv+FwVDaSpuFxqeILfxXh8rAtCESbD0l5WBkGC6vfxu/5XdBIWZNjr4 JgHfCldK3Kq/mUFyalr1E4pOaYQLLjslTls8RTnC+FC5iDOeswsRiN2popuWNNVHY7U+ iJB8rqIsALJJImdpHcIPcwb4MKTGoOcRsnUAftu2chgCs7pg5DRTDz1upYmzcCUp1gf4 41T7Q3a1ms/yA9TCvPtTzhHhv1oU+K0JAydx9yTZWzGKo/fS90Zjj+5W3UIFr3KqK/sH InlDysmVYgKGce85JuwngBGJn/jDdjv01sgXRHlJRPMecX02X3CUR5DcT8PFhT4Coi7y Prcg== X-Gm-Message-State: AAQBX9doHPCPaMPsz+NGuoJ5GYnPbWbVYl2ztY90FHB54saWv59s+Daw xMGdox3z3E9snjmym7v78//EKVu6qzVFyfpIBh9ZWo/gn8S6XRxE/+n4X6IDX20pRZPeX6v2ZiK V4gEyxbQ= X-Received: by 2002:a05:6214:21e9:b0:5d5:5c9a:77da with SMTP id p9-20020a05621421e900b005d55c9a77damr50219441qvj.37.1680477299733; Sun, 02 Apr 2023 16:14:59 -0700 (PDT) X-Google-Smtp-Source: AKy350YNWTUJTOPxRR1/fllTHv/bCcHKZDe5GtCn6uUa79deizAuAlthaJRjJ649IMoFi5NPmtihug== X-Received: by 2002:a05:6214:21e9:b0:5d5:5c9a:77da with SMTP id p9-20020a05621421e900b005d55c9a77damr50219426qvj.37.1680477299433; Sun, 02 Apr 2023 16:14:59 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.ma.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id de27-20020a05620a371b00b00748676d89e7sm2333367qkb.8.2023.04.02.16.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 16:14:59 -0700 (PDT) Message-ID: <7425dd2f645e2ec6cc6701a2c1081f0df597e958.camel@redhat.com> Subject: Re: [GSoC] Interest and initial proposal for project on reimplementing cpychecker as -fanalyzer plugin From: David Malcolm To: Sun Steven , "gcc@gcc.gnu.org" Date: Sun, 02 Apr 2023 19:14:58 -0400 In-Reply-To: References: User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 Sun, 2023-04-02 at 17:24 +0000, Sun Steven via Gcc wrote: > Hi, Eric, Malcom, Hi - and welcome to the GCC community. >=20 > Sorry that I didn't check this thread before. >=20 > It sounds like there are a lot of things to do. I want to offer some > help. >=20 > Let me add some backgrounds of memory management in python here. >=20 >=20 > ## Intro (for people unfamiliar with CPython) >=20 > Unlike programs written in C++, where the compiler automatically adds > destructors on all exit paths, CPython requires manual memory > management > on PyObject*. >=20 > The current CPython has 2 major memory management mechanisms, > including reference counting and a mark-and-sweep gc for cyclic > references. > The former acts as the major mechanism. PyObject gets destructed when > the refcount drops to zero. (nods) FWIW I wrote the original cpychecker code because I was sick of buggy extension modules crashing /usr/bin/python... and all the bug reports about it that were landing in my inbox (I was the maintainer of Python within Fedora/RHEL back then). >=20 > ## CPython has made great efforts to reduce memory errors. >=20 > With specific compile flags on, the CPython interpreter records the > total > refcount, also it aborts when refcount drops below zero (being double > freed). > This helps to discover memory leaks. PEP 683 (implemented in 3.12) > also > introduced "immortal objects" with initial refcount 999999999, > prevent it from > being accidentally freed (such as small integers). That feature is new to me (I last worked on CPython internals back in the 2 to 3 transition era); thanks! [...snip...] >=20 > ## Why I want to participate in? >=20 > I am currently working on the initial implementations of PEP 701 (a > new > f-string=E2=80=8B parser). During the testing, I discovered (and fixed) 3 > memory leaks. > As you can see, even the most experienced CPython developers > sometimes > forget to properly decrease refs. I think it will be inspiring if a > new analysis > tool was made available as a compiler builtin. It will lead to a > better CPython. >=20 >=20 > I do not know if GSoC allows collaborations. Maybe the headcount is > limited, > or maybe I am too senior for GSoC. But I think I am still a rookie in > front of > GCC. I'd be up for a collaboration between you and Eric (assuming Eric is, of course), as the project is very large and there are several logical components to it that you could carve up between the two of you. That said it may be out of our hands, it depends on: (a) how many slots we get allocated to us from Google (b) GSoC is meant for newcomers to open source development; it sounds like you might already have significant experience. I don't know what GSoC's threshold is. > I want to contribute, no matter the forms. That's great. It sounds like you have considerable knowledge of CPython internals (a decade more up-to-date than mine!), and hopefully you have recent contacts within the CPython community in terms of getting traction there. Some notes about a GSoC application: Do you have a link to your github so we can see your CPython contributions? How's your C++? Have you tried building GCC from source yet? FWIW I felt intimidated back when I first started working on GCC itself; I wrote this guide to help people get started: https://gcc-newbies-guide.readthedocs.io/en/latest/ Note that the deadline for submitting proposals to the official GSoC website is April 4 - 18:00 UTC (i.e. this coming Tuesday) and that Google are very strict about that deadline; see: https://developers.google.com/open-source/gsoc/timeline Hope this is helpful Dave