public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/104560] New: False positive from -Wanalyzer-free-of-non-heap seen with rdma-core Date: Tue, 15 Feb 2022 22:34:42 +0000 [thread overview] Message-ID: <bug-104560-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104560 Bug ID: 104560 Summary: False positive from -Wanalyzer-free-of-non-heap seen with rdma-core Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- Created attachment 52450 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52450&action=edit Reduced reproducer I'm seeing various -Wanalyzer-free-of-non-heap when compiling rdma-core with -fanalyzer, e.g.: rdma-core-33.0/providers/mlx5/mlx5.c: scope_hint: In function 'mlx5_uninit_device' rdma-core-33.0/providers/mlx5/mlx5.c:2101:9: warning[-Wanalyzer-free-of-non-heap]: 'free' of '&*verbs_device.device' which points to memory not on the heap # 2099| struct mlx5_device *dev = to_mdev(&verbs_device->device); # 2100| # 2101|-> free(dev); # 2102| } # 2103| Am attaching a reproducer, which triggers the current false positive with trunk when compiled without optimization: <source>: In function 'mlx5_uninit_device': <source>:42:9: warning: 'free' of 'dev' which points to memory not on the heap [CWE-590] [-Wanalyzer-free-of-non-heap] 42 | __builtin_free(dev); | ^~~~~~~~~~~~~~~~~~~ 'mlx5_uninit_device': events 1-3 | | 40 | struct mlx5_device *dev = to_mdev(&verbs_device->device); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) pointer is from here | | (2) pointer is from here | 41 | | 42 | __builtin_free(dev); | | ~~~~~~~~~~~~~~~~~~~ | | | | | (3) call to 'free' here | Uploaded to Compiler Explorer as: https://godbolt.org/z/nazc15z1h
next reply other threads:[~2022-02-15 22:34 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-15 22:34 dmalcolm at gcc dot gnu.org [this message] 2022-02-16 23:49 ` [Bug analyzer/104560] " cvs-commit at gcc dot gnu.org 2022-02-16 23:58 ` dmalcolm at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104560-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).