public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "egallager at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/80532] warning on pointer access after free
Date: Tue, 03 Nov 2020 04:11:16 +0000 [thread overview]
Message-ID: <bug-80532-4-kpyR2UiTXy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-80532-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80532
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #3)
> My analyzer finds these:
>
> ./xgcc -B. -fanalyzer -c ../../src/gcc/testsuite/gcc.dg/analyzer/pr80532.c
> -ftime-report
> ../../src/gcc/testsuite/gcc.dg/analyzer/pr80532.c: In function ‘free_list’:
> ../../src/gcc/testsuite/gcc.dg/analyzer/pr80532.c:14:28: warning: use after
> ‘free’ of ‘p’ [CWE-416] [-Wanalyzer-use-after-free]
> 14 | for (p = head; p != 0; p = p->next) /* { dg-warning "use after
> 'free' of 'p'" } */
> | ~~^~~~~~~~~
> ‘free_list’: events 1-4
> |
> | 14 | for (p = head; p != 0; p = p->next) /* { dg-warning "use
> after 'free' of 'p'" } */
> | | ^~~ ~~~~~~~~~~~
> | | | |
> | | | (4) use after ‘free’ of ‘p’; freed
> at (3)
> | | (1) following ‘true’ branch (when ‘p’ is non-NULL)...
> | 15 | free (p); /* { dg-message "freed here" } */
> | | ~~~~~~~~
> | | |
> | | (2) ...to here
> | | (3) freed here
> |
> ../../src/gcc/testsuite/gcc.dg/analyzer/pr80532.c:14:28: note: 8 duplicates
> 14 | for (p = head; p != 0; p = p->next) /* { dg-warning "use after
> 'free' of 'p'" } */
> | ~~^~~~~~~~~
> ../../src/gcc/testsuite/gcc.dg/analyzer/pr80532.c: In function ‘foobar’:
> ../../src/gcc/testsuite/gcc.dg/analyzer/pr80532.c:24:3: warning:
> double-‘free’ of ‘p’ [CWE-415] [-Wanalyzer-double-free]
> 24 | free (p); /* { dg-warning "double-'free' of 'p'" } */
> | ^~~~~~~~
> ‘foobar’: events 1-2
> |
> | 22 | memset (p, 0, n);
> | | ^~~~~~~~~~~~~~~~
> | | |
> | | (1) first ‘free’ here
> | 23 | free (p); /* { dg-message "first 'free' here" } */
> | 24 | free (p); /* { dg-warning "double-'free' of 'p'" } */
> | | ~~~~~~~~
> | | |
> | | (2) second ‘free’ here; first ‘free’ was at (1)
> |
So... since the analyzer has been merged now... ok to close as FIXED?
next parent reply other threads:[~2020-11-03 4:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-80532-4@http.gcc.gnu.org/bugzilla/>
2020-11-03 4:11 ` egallager at gcc dot gnu.org [this message]
2020-12-01 17:35 ` msebor at gcc dot gnu.org
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2021-05-04 16:44 ` egallager at gcc dot gnu.org
2021-05-04 19:40 ` msebor at gcc dot gnu.org
2021-12-15 17:41 ` msebor at gcc dot gnu.org
2022-01-15 23:46 ` cvs-commit at gcc dot gnu.org
2022-01-16 0:04 ` msebor at gcc dot gnu.org
2023-10-21 10:46 ` egallager 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-80532-4-kpyR2UiTXy@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: link
Be 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).