public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/102633] New: warning for self-initialization despite -Wno-init-self
@ 2021-10-06 21:40 msebor at gcc dot gnu.org
  2021-10-06 21:42 ` [Bug middle-end/102633] [11/12 Regression] " msebor at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-06 21:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102633

            Bug ID: 102633
           Summary: warning for self-initialization despite -Wno-init-self
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC issues -Wuninitialized for cv-qualified variables initialized with
themselves even when -Wno-init-self is in effect.

$ cat x.c && gcc -O2 -S -Wall -Wno-init-self -xc++ x.c
int f (void)
{
  int i = i;           // no warning (good)
  return i;
}

int g (void)
{
  const int i = i;     // -Wuninitialized (bug)
  return i;
}

int h (void)
{
  volatile int i = i;  // -Wuninitialized (bug)
  return i;
}

x.c: In function ‘int g()’:
x.c:9:13: warning: ‘i’ is used uninitialized [-Wuninitialized]
    9 |   const int i = i;     // -Wuninitialized (bug)
      |             ^
x.c:9:13: note: ‘i’ was declared here
    9 |   const int i = i;     // -Wuninitialized (bug)
      |             ^
x.c: In function ‘int h()’:
x.c:15:20: warning: ‘i’ is used uninitialized [-Wuninitialized]
   15 |   volatile int i = i;  // -Wuninitialized (bug)
      |                    ^
x.c:15:16: note: ‘i’ declared here
   15 |   volatile int i = i;  // -Wuninitialized (bug)
      |                ^

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-02-22 16:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 21:40 [Bug middle-end/102633] New: warning for self-initialization despite -Wno-init-self msebor at gcc dot gnu.org
2021-10-06 21:42 ` [Bug middle-end/102633] [11/12 Regression] " msebor at gcc dot gnu.org
2021-10-06 21:47 ` msebor at gcc dot gnu.org
2021-10-07  9:02 ` rguenth at gcc dot gnu.org
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2022-07-26 13:25 ` [Bug middle-end/102633] [11/12/13 " rguenth at gcc dot gnu.org
2022-07-26 14:09 ` mpolacek at gcc dot gnu.org
2022-07-26 14:28 ` mpolacek at gcc dot gnu.org
2022-07-27  6:11 ` muecker at gwdg dot de
2022-08-11 14:29 ` cvs-commit at gcc dot gnu.org
2022-08-11 14:30 ` [Bug middle-end/102633] [11/12 " mpolacek at gcc dot gnu.org
2023-02-10 15:16 ` mpolacek at gcc dot gnu.org
2023-02-10 17:47 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:55 ` jakub at gcc dot gnu.org
2023-02-22 16:10 ` [Bug middle-end/102633] [11 " mpolacek at gcc dot gnu.org

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).