Bug 82810

Summary: missed uninitialized variable warning in for/while loop
Product: gcc Reporter: Jan Smets <jan.smets>
Component: middle-endAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: manu
Priority: P3 Keywords: diagnostic
Version: 6.2.1   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 24639    

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 ***