From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A50C2385840F; Fri, 31 Mar 2023 20:49:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A50C2385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680295795; bh=hweIZRZPVSJd4upKBIv0Gg9UzNxWI39okixu0ngLYec=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l7K8Wp1iT6i0avGGA44HyNVVAVclRpI4QdMX/Uj2prd4Pqc2htJG8MpV+Jg/MEtFD 9yJtmtULa1uXswxZWVVoVt/423sHKdKd9lcVKftYELWmL8f/1bvrfBlR2oIxmpyq5/ kHYYMxHuq9JMnN5GwJioBEi8QrfS3Ot+QzDMhXxc= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/107396] [13 regression] new test case gcc.dg/analyzer/pipe-glibc.c in r13-3466-g792f039fc37faa fails with excess errors Date: Fri, 31 Mar 2023 20:49:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107396 --- Comment #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:92f02e754ca2fbcd56dbd7b3949147d50bab99a0 commit r13-6961-g92f02e754ca2fbcd56dbd7b3949147d50bab99a0 Author: Jakub Jelinek Date: Fri Mar 31 22:48:44 2023 +0200 testsuite, analyzer: Fix up pipe-glibc.c testcase [PR107396] The gcc.dg/analyzer/pipe-glibc.c test FAILs when using recent glibc hea= ders and succeeds with older headers. The important change is that =20=20=20 https://sourceware.org/git/?p=3Dglibc.git;a=3Dcommit;h=3Dc1760eaf3b575ad174= fd88b252fd16bd525fa818 in 2021 added __attribute__ ((__malloc__ (fclose, 1))) attribute to fdo= pen, so in write_to_pipe there is an excess warning: .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c: In function 'write_to_pipe': .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3: warning: use of possibly-NULL 'stream' where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:27:12: note: (1) this ca= ll could return NULL .../gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c:28:3: note: (2) argument= 4 ('stream') from (1) could be NULL where non-null expected : note: argument 4 of '__builtin_fwrite' must be non-null Strangely, nothing is reported on the read_from_pipe function, seems fwrite/fprintf/fputc etc. are builtins in GCC and we mark the FILE * arguments as nonnull there on the builtin declarations, while fgetc/fre= ad etc. aren't builtins and glibc doesn't mark any of those using nonnull. Shall we change that on the glibc side? Anyway, because this differs based on glibc version and I think the above warning is not the primary intention of the test, I think it is best to tweak it so that this warning isn't reported. Another option would be avoid using glibc headers and use our own declarations, or make sure we add the malloc with fclose attribute ourselves (but fdopen in the libc headers could be a macro, so not sure __typeof (fdopen) fdopen __attribute__ ((__malloc__, __malloc__ (fclose, 1))); would work). Or use -Wno-analyzer-possible-null-arguments in dg-additional-options? 2023-03-31 Jakub Jelinek PR analyzer/107396 * gcc.dg/analyzer/pipe-glibc.c (read_from_pie, write_to_pipe): = Exit if fdopen returns NULL.=