From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25E153852759; Wed, 12 Oct 2022 01:09:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25E153852759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665536979; bh=63aa8HvVwWwVOVCk0z5OA+iwQSl9WgXuOLxnJc0b4Wg=; h=From:To:Subject:Date:From; b=ZTUfeVxR2JHmHZZDHRWWkbUt/hxdoeX0XbKSYKBz6Qrw2KOvMBewLIJFnKhwcvxtn WoEQnPZkbTN+xGKRDrD8Ca9obt0PqrPJ4fMB4+/sNjohnrK0h2B/9hkS4gXTw+rHMU 0bOC4VvdD4+jbWxKoSZnwk/LsD1W+nKHMnKrep7Y= From: "urs at akk dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/107225] New: FP with -Wanalyzer-mismatching-deallocation Date: Wed, 12 Oct 2022 01:09:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: urs at akk dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone cf_gcchost cf_gcctarget cf_gccbuild Message-ID: 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=3D107225 Bug ID: 107225 Summary: FP with -Wanalyzer-mismatching-deallocation Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: urs at akk dot org Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Build: x86_64-pc-linux-gnu gcc build from git @ ab332cd78d083edb2fddaa3c02578cafade12725 with configure --program-suffix=3D-13 --enable-languages=3Dc,lto --enable-lto --disable-multilib make -j 4 BOOT_CFLAGS=3D'-pipe -O0 -w' bootstrap on x86_64-pc-linux-gnu (Intel(R) Core(TM) i7-6700T); Ubuntu 22.04.1 LTS; GL= IBC 2.35-0ubuntu3.1 The somewhat reduced testcase shows (besides other stuff) a false positive = with gcc-13 -v -save-temps -freport-bug -g -O2 -Wextra -Wpedantic -pipe -Wall -Winline -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wbad-function-cast -Wnested-externs -Wcast-align -Wpointer-arith -Waggregate-return -Wcast-qual -Wwrite-strings -Wundef -Wpa= cked -Wfloat-equal -Wunused-macros -Wold-style-definition -Winit-self -Wmissing-include-dirs -Wlogical-op -Wjump-misses-init -Wformat=3D2 -Wshift-overflow=3D2 -Wnull-dereference -Wduplicated-cond -Walloc-zero -Wal= loca -Wstringop-overflow=3D2 -Wduplicated-branches -Wno-format-nonliteral -Wno-stringop-truncation -Wno-format-truncation -fanalyzer -c fp.c -o fp.o fp.c:83:25: warning: =E2=80=98fp=E2=80=99 should have been deallocated with= =E2=80=98fclose=E2=80=99 but was deallocated with =E2=80=98pclose=E2=80=99 [CWE-762] [-Wanalyzer-mismatching= -deallocation] 83 | pclose(fp); | ^~~~~~~~~~ looks like the analyzer doesn't notice that it took the false branch in lin= e 51 and thus has to take the false branch in line 82 again=