public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112739] New: variable 'a' is uninitialized when used within its own initialization
@ 2023-11-27 23:38 kxiang at umich dot edu
  2023-11-27 23:41 ` [Bug c/112739] Not emitting warning when using an uninitialized variable " kxiang at umich dot edu
  2023-11-27 23:44 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: kxiang at umich dot edu @ 2023-11-27 23:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112739
           Summary: variable 'a' is uninitialized when used within its own
                    initialization
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kxiang at umich dot edu
  Target Milestone: ---

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

* [Bug c/112739] Not emitting warning when using an uninitialized variable within its own initialization
  2023-11-27 23:38 [Bug c/112739] New: variable 'a' is uninitialized when used within its own initialization kxiang at umich dot edu
@ 2023-11-27 23:41 ` kxiang at umich dot edu
  2023-11-27 23:44 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: kxiang at umich dot edu @ 2023-11-27 23:41 UTC (permalink / raw)
  To: gcc-bugs

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

Yiming Xiang <kxiang at umich dot edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|variable 'a' is             |Not emitting warning when
                   |uninitialized when used     |using an uninitialized
                   |within its own              |variable within its own
                   |initialization              |initialization

--- Comment #1 from Yiming Xiang <kxiang at umich dot edu> ---
This piece of code doesn't emit any warning with the following command:

gcc -Wall -Werror -Wuninitialized

#include <stdio.h>

int main(){
    int a = 8;
    {
        int a = a;
        printf("%d\n", a);
    }
    printf("%d\n", a);
}

Here a is used within its own initialization, so it should emit a warning
(clang does)

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

* [Bug c/112739] Not emitting warning when using an uninitialized variable within its own initialization
  2023-11-27 23:38 [Bug c/112739] New: variable 'a' is uninitialized when used within its own initialization kxiang at umich dot edu
  2023-11-27 23:41 ` [Bug c/112739] Not emitting warning when using an uninitialized variable " kxiang at umich dot edu
@ 2023-11-27 23:44 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-27 23:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Warning-Options.html#index-Winit-self

*** This bug has been marked as a duplicate of bug 91225 ***

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

end of thread, other threads:[~2023-11-27 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-27 23:38 [Bug c/112739] New: variable 'a' is uninitialized when used within its own initialization kxiang at umich dot edu
2023-11-27 23:41 ` [Bug c/112739] Not emitting warning when using an uninitialized variable " kxiang at umich dot edu
2023-11-27 23:44 ` pinskia 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).