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.133.124]) by sourceware.org (Postfix) with ESMTPS id 14AAA3858C39 for ; Wed, 6 Jul 2022 15:37:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14AAA3858C39 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-346-ajEc3ZBQPEO1rebnvAVl7w-1; Wed, 06 Jul 2022 11:37:16 -0400 X-MC-Unique: ajEc3ZBQPEO1rebnvAVl7w-1 Received: by mail-qt1-f200.google.com with SMTP id k16-20020ac84790000000b0031d446a2d1eso10144455qtq.6 for ; Wed, 06 Jul 2022 08:37:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=+9ZWhnngx3k16J6R5iRSCNo7jE+EV7D6dsf6wCMOweE=; b=x0KQmmBmFx5b1AhOytkdziZnGA8LgYbrG8C8t33n9Av+YxrJlXLgD68hNHCEA3G+9K t1Rgy5e5iLUUgWsb4qxFEpGVsIGjdKWe2KnXCVAMERx/l2sEgBIoPotZUeB4cAURClIw D4nJFfBjob8L9My9xfpfD1CurLWJSVljNea2AhnsxkojvHCa8BQq7sqc8Ge5VwKzmJrf TyJ4KbX5wNMMSu9EzTAHM/g5hCbr2Pt0tSF6YZORK4GR5G+1my+ty/0L8d2pc6R9Xodd BOhoSjbwV1K+sy+HQeWLQpRy38WxkjFZNzb+JYRaeolOCnYW9Llyni5wEZKP2KokJWny cB6A== X-Gm-Message-State: AJIora8o+XbeFj61+gCoCAsdXUX3yH7BovFAOC2D+IAuApPrw2FuUnF1 +cpMWCCaBJZiGGe5VDOvouOg76sboAW+px4CMTf0WQkj3Uib7nP5XLRR2wW2J1Xhi9GOCHFzzTS N8AhcEW6kAlpF/cVI6w== X-Received: by 2002:a05:6214:e47:b0:470:4894:730b with SMTP id o7-20020a0562140e4700b004704894730bmr37161103qvc.69.1657121836135; Wed, 06 Jul 2022 08:37:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vAGLf5P97vqqedfcveh9Jcply7LKsrYP9gBGfFTOpjf/+rkgs+HAc3dywJoHi8qQYFEeJbAA== X-Received: by 2002:a05:6214:e47:b0:470:4894:730b with SMTP id o7-20020a0562140e4700b004704894730bmr37161085qvc.69.1657121835894; Wed, 06 Jul 2022 08:37:15 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.nh.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id c21-20020ac87d95000000b003172da668desm26622548qtd.50.2022.07.06.08.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 08:37:15 -0700 (PDT) Message-ID: <8a58ab91f47b896591be4749177aefc825af9c52.camel@redhat.com> Subject: Re: [PATCH 3/3] analyzer: add a new testcase to demonstrate passsing of a file descriptor to a function that does not emit any warning From: David Malcolm To: mirimnan017@gmail.com, gcc-patches@gcc.gnu.org Cc: Immad Mir Date: Wed, 06 Jul 2022 11:37:14 -0400 In-Reply-To: References: <20220706142543.3790-1-mirimmad@outlook.com> User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-List-Received-Date: Wed, 06 Jul 2022 15:37:19 -0000 On Wed, 2022-07-06 at 19:55 +0530, Immad Mir wrote: > gcc/testsuite/ChangeLog: >         * gcc.dg/analyzer/fd-4.c: Add a new testcase to demonstrate > passsing >         of a file descriptor to a function that does not emit any > warning. The patch itself is OK for trunk, but the initial line of the commit message is probably too long - this gets used as the title of the commit in various git UIs. I can't remember the recommended limit, it might be 80 chars (which can be hard when the leading "analyzer: " takes up 10 chars). Please reduce the length before pushing, maybe to: analyzer: add testcase of using closed fd without warning or somesuch Thanks Dave > > Signed-off-by: Immad Mir > --- >  gcc/testsuite/gcc.dg/analyzer/fd-4.c | 10 ++++++++++ >  1 file changed, 10 insertions(+) > > diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-4.c > b/gcc/testsuite/gcc.dg/analyzer/fd-4.c > index c992db619e7..fcfa6168efa 100644 > --- a/gcc/testsuite/gcc.dg/analyzer/fd-4.c > +++ b/gcc/testsuite/gcc.dg/analyzer/fd-4.c > @@ -1,3 +1,5 @@ > +#include > + >  int open(const char *, int mode); >  void close(int fd); >  int write (int fd, void *buf, int nbytes); > @@ -60,3 +62,11 @@ test_4 (const char *path, void *buf) >          /* {dg-message "\\(3\\) 'write' on closed file descriptor > 'fd'; 'close' was at \\(2\\)" "" {target *-*-*} .-1 } */ >      } >  } > + > +void > +test_5 (const char *path) > +{ > +    int fd = open (path, O_RDWR); > +    close(fd); > +    printf("%d", fd); /* { dg-bogus "'printf' on a closed file > descriptor 'fd'" } */ > +} > \ No newline at end of file