public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106578] spurious -Wuse-after-free=2 after conditional free() Date: Wed, 10 Aug 2022 14:46:44 +0000 [thread overview] Message-ID: <bug-106578-4-a9mnuK6yNQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106578-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106578 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-08-10 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The pattern matching of the if (result == NULL) doesn't work reliably without optimization because it goes through memory: <bb 2> : tmp_5 = buf; _1 = realloc (tmp_5, 10); buf = _1; buf.0_2 = buf; if (buf.0_2 == 0B) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : free (tmp_5); <bb 4> : _9 = 0; <bb 5> : <L2>: return _9; using 'tmp' instead makes it properly fire. Could be fixed with extra compile-time cycles doing virtual VN like we do for early uninit analysis (note this is the late waccess pass).
next prev parent reply other threads:[~2022-08-10 14:46 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-10 14:16 [Bug middle-end/106578] New: " gcc.gnu.org at aydos dot de 2022-08-10 14:22 ` [Bug middle-end/106578] " gcc.gnu.org at aydos dot de 2022-08-10 14:46 ` rguenth at gcc dot gnu.org [this message] 2022-08-10 16:04 ` [Bug middle-end/106578] spurious -Wuse-after-free=2 after conditional free() when not optimizing gcc.gnu.org at aydos dot de 2022-08-11 9:30 ` gcc.gnu.org at aydos dot de
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-106578-4-a9mnuK6yNQ@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).