Bug 82810 - missed uninitialized variable warning in for/while loop
Summary: missed uninitialized variable warning in for/while loop
Status: RESOLVED DUPLICATE of bug 18501
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 6.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: diagnostic
Depends on:
Blocks: Wuninitialized
  Show dependency treegraph
Reported: 2017-11-02 09:46 UTC by Jan Smets
Modified: 2017-11-08 00:40 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Jan Smets 2017-11-02 09:46:36 UTC
In the following code x clearly is used uninitialized

#include <stdio.h>
int main(void)
    while (1) 
        int x;  
        printf("x=%d\n", x); 
        x = 0;
    return 0;

Possibly dup of 82101 ?
Comment 1 Manuel López-Ibáñez 2017-11-08 00:40:16 UTC
I guess this prints 0. If so, then it is Infamous 18501. Those are easy to recognize because there is an assignment to the uninitialized variable after the uninitialized use.

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