From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1241E3858C50; Wed, 29 Mar 2023 17:16:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1241E3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680110215; bh=LG8VgXoPGpjm/tSxQWe+jPV1EFJptMOHEIAkRmRC03s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YmYTsbLxPjLi2/6iiEOdgqSkQBYWzWPCSr4IpbT+SoAkKA5mA6L/J4x1UFMQUYBCp HpABJXCnYeAsf9QNx23K12lLDv3MPL7l7Vv5BaePVRWnkdd/jRpXJbxnV3JUUN4Fhe quxFuAQq3WyAIQBp+atNrx3F3+41tUHVTd/kNMcw= From: "jakub 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: Wed, 29 Mar 2023 17:16:53 +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: jakub 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: cc 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 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- I think the difference is https://sourceware.org/git/?p=3Dglibc.git;a=3Dcommit;h=3Dc1760eaf3b575ad174= fd88b252fd16bd525fa818 which added __attribute__((malloc)) to fdopen among other things. It is strange that it is reported just for fwrite and not for fgetc in the other function though, both access potentially NULL stream. Probably because {fwrite,putc,fputc,fputs}{,_unlocked} and printf family are builtins and have nonnull attribute for the FILE * argument, but fgetc or f= read is not and glibc doesn't use nonnull for those. Shall we than use 2023-03-29 Jakub Jelinek PR analyzer/107396 * gcc.dg/analyzer/pipe-glibc.c (read_from_pie, write_to_pipe): Exit if fdopen returns NULL. --- gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c.jj 2022-10-25 10:37:28.106531709 +0200 +++ gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c 2023-03-29 19:14:48.7897664= 75 +0200 @@ -13,6 +13,8 @@ read_from_pipe (int file) FILE *stream; int c; stream =3D fdopen (file, "r"); + if (stream =3D=3D NULL) + exit (EXIT_FAILURE); while ((c =3D fgetc (stream)) !=3D EOF) putchar (c); fclose (stream); @@ -25,6 +27,8 @@ write_to_pipe (int file) { FILE *stream; stream =3D fdopen (file, "w"); + if (stream =3D=3D NULL) + exit (EXIT_FAILURE); fprintf (stream, "hello, world!\n"); fprintf (stream, "goodbye, world!\n"); fclose (stream); because this warning is not what the test wants to verify?=