public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/99945] missing maybe-uninitialized warning when using nested function vs SRA Date: Tue, 11 Jul 2023 19:02:42 +0000 [thread overview] Message-ID: <bug-99945-4-9YI1usSjCx@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99945-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99945 --- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This has nothing to do with cleanup functions but just nested functions vs SRA. Take: ``` int foo1 (void); int foo2 (int); #ifdef D #define N #else #define N ! #endif int bar (void) { int i; auto void cf (int *t) { foo2 (i); } int t; t = 0; if (foo1 ()) i = foo1 (); i = N foo1 () || i; foo2 (i); cf(&t); return 0; } ``` Which is the same as the original one without the cleanup attribute (basically added the call to cf). Using `-O2 -Wall -DD -fno-tree-sra` causes the following warning the be done: ``` <source>: In function 'bar': <source>:22:17: warning: 'FRAME.1.i' may be used uninitialized [-Wmaybe-uninitialized] 22 | i = N foo1 () || i; | ~~~~~~~~^~~~ <source>:11:5: note: 'FRAME.1' declared here 11 | int bar (void) | ^~~ ``` Without `-fno-tree-sra`, there is no warning because SRA produces: ``` # SR.4_14 = PHI <SR.4_12(D)(5), _9(3)> _2 = foo1 (); _17 = _2 | SR.4_14; ``` which should 100% warn but since SR.4 is artifical does not.
next prev parent reply other threads:[~2023-07-11 19:02 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-06 21:28 [Bug c/99945] New: missing maybe-uninitialized warning when using a cleanup function vincent-gcc at vinc17 dot net 2021-04-06 22:19 ` [Bug c/99945] " pinskia at gcc dot gnu.org 2021-04-07 0:01 ` vincent-gcc at vinc17 dot net 2021-04-07 0:08 ` vincent-gcc at vinc17 dot net 2021-04-07 0:09 ` [Bug sanitizer/99945] " msebor at gcc dot gnu.org 2021-04-07 7:29 ` rguenth at gcc dot gnu.org 2021-04-07 15:23 ` msebor at gcc dot gnu.org 2023-07-11 19:02 ` pinskia at gcc dot gnu.org [this message] 2023-07-11 19:07 ` [Bug tree-optimization/99945] missing maybe-uninitialized warning when using nested function vs SRA pinskia 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-99945-4-9YI1usSjCx@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).