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 tree-optimization/101494] -Wmaybe-uninitialized false alarm with memrchr of size 0 Date: Wed, 21 Jul 2021 18:05:30 +0000 [thread overview] Message-ID: <bug-101494-4-OzoWKO351O@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101494-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101494 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-07-21 Status|UNCONFIRMED |NEW CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. I think this exposes two underlying bugs: one that the initialization isn't detected and another that the second argument to attribute access isn't respected. A slightly enhanced test case: $ cat b.c && gcc -O2 -S -Wall b.c __attribute__ ((access (read_only, 1, 2))) void f (const void*, int); void g (void) { char *p = __builtin_alloca (1); *p = 0; f (p, 0); // bogus -Wmaybe-uninitialized } void h (void) { char *p = __builtin_malloc (1); f (p, 0); // bogus -Wmaybe-uninitialized } b.c: In function ‘g’: b.c:7:3: warning: ‘p’ is used uninitialized [-Wuninitialized] 7 | f (p, 0); // bogus -Wmaybe-uninitialized | ^~~~~~~~ b.c:1:49: note: in a call to ‘f’ declared with attribute ‘access (read_only, 1, 2)’ here 1 | __attribute__ ((access (read_only, 1, 2))) void f (const void*, int); | ^ b.c: In function ‘h’: b.c:13:3: warning: ‘p’ is used uninitialized [-Wuninitialized] 13 | f (p, 0); // bogus -Wmaybe-uninitialized | ^~~~~~~~ b.c:1:49: note: in a call to ‘f’ declared with attribute ‘access (read_only, 1, 2)’ here 1 | __attribute__ ((access (read_only, 1, 2))) void f (const void*, int); | ^
next prev parent reply other threads:[~2021-07-21 18:05 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-18 2:08 [Bug tree-optimization/101494] New: " eggert at cs dot ucla.edu 2021-07-18 9:18 ` [Bug tree-optimization/101494] " bruno at clisp dot org 2021-07-21 18:05 ` msebor at gcc dot gnu.org [this message] 2021-07-21 18:09 ` [Bug tree-optimization/101494] [11 Regression] " msebor at gcc dot gnu.org 2021-07-22 23:06 ` msebor at gcc dot gnu.org 2021-07-28 7:07 ` rguenth at gcc dot gnu.org 2021-07-28 22:27 ` cvs-commit at gcc dot gnu.org 2021-07-28 22:27 ` msebor at gcc dot gnu.org 2022-04-21 7:49 ` rguenth at gcc dot gnu.org 2023-05-29 10:05 ` jakub 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-101494-4-OzoWKO351O@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).