public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/89788] trunk/liboffloadmic/runtime/emulator/coi_host.cpp:175]: (error) Null pointer dereference (missed -Wnull-dereference) Date: Mon, 08 Jun 2020 19:57:25 +0000 [thread overview] Message-ID: <bug-89788-4-16NmoapA3C@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-89788-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89788 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Blocks|86172 | --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- The code is still in liboffloadmic/runtime/emulator/coi_host.cpp but I wonder why it isn't diagnosed. Passing a null pointer of any other type but char* to %s is diagnosed by -Wformat. Usually only with optimization, passing a null pointer to %s is then diagnosed by -Wformat-overflow. A test case for the latter is below. Could something like -Wno-system-headers be somehow disablig it? $ cat pr89788.c && gcc -O2 -S -Wall -Wextra pr89788.c #include <dirent.h> #include <stdio.h> void f (const char *path) { DIR *p = opendir (path); if (!p) fprintf (stderr, "error: %s", (char*)p); } pr89788.c: In function ‘f’: pr89788.c:8:5: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 8 | fprintf (stderr, "error: %s", (char*)p); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86172 [Bug 86172] [meta-bug] issues with -Wnull-dereference
next parent reply other threads:[~2020-06-08 19:57 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-89788-4@http.gcc.gnu.org/bugzilla/> 2020-06-08 19:57 ` msebor at gcc dot gnu.org [this message] 2022-11-04 10:55 ` tschwinge 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-89788-4-16NmoapA3C@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).