public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9075] analyzer, testsuite: add regression test [PR110520] Date: Mon, 19 Feb 2024 23:10:00 +0000 (GMT) [thread overview] Message-ID: <20240219231001.09A213858D20@sourceware.org> (raw) https://gcc.gnu.org/g:eb37ea529745c38dcf86c3cdbedb66df69ea9e35 commit r14-9075-geb37ea529745c38dcf86c3cdbedb66df69ea9e35 Author: David Malcolm <dmalcolm@redhat.com> Date: Mon Feb 19 18:07:59 2024 -0500 analyzer, testsuite: add regression test [PR110520] gcc/testsuite/ChangeLog: PR analyzer/110520 * c-c++-common/analyzer/null-deref-pr110520.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com> Diff: --- gcc/testsuite/c-c++-common/analyzer/null-deref-pr110520.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/testsuite/c-c++-common/analyzer/null-deref-pr110520.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr110520.c new file mode 100644 index 000000000000..b57027689eed --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr110520.c @@ -0,0 +1,8 @@ +#include "analyzer-decls.h" + +int main(void) { + char buf[] = "0"; + int *ptr = (int *)(__builtin_strlen(buf) - 1); + __analyzer_eval((__builtin_strlen(buf)) == 1); /* { dg-warning "TRUE" } */ + *ptr = 10086; /* { dg-warning "dereference of NULL 'ptr'" } */ +}
reply other threads:[~2024-02-19 23:10 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240219231001.09A213858D20@sourceware.org \ --to=dmalcolm@gcc.gnu.org \ --cc=gcc-cvs@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).