https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109530
Bug ID: 109530 Summary: Warning "is used uninitialized" raised for an initialized variable. Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: patrick.pelissier at gmail dot com Target Milestone: --- For the following program: #include <stdio.h> #include <setjmp.h> jmp_buf buf; jmp_buf buf1; typedef struct ry_s { struct ry_s *next; } ry_t[1]; struct ry_s *m_global; static inline void ry_init(ry_t state) { m_global = state; } static inline void ry_clear(ry_t state) { m_global = state->next; } int func2(void) { for(_Bool b = 1 ; b ; b = 0) for(ry_t test1 ; b ; ry_clear(test1), b = 0 ) if (ry_init(test1), setjmp (buf) == 0) { FILE *f = fopen("tmp","wt"); if ((setjmp (buf1) == 0) ) { fprintf(f, "This is a text\n"); fclose(f); } } return 0; } When running with "-O2 -Wall -Wextra", I get the following warning: <source>: In function 'func2': <source>:31:17: warning: 'f' is used uninitialized [-Wuninitialized] 31 | FILE *f = fopen("tmp","wt"); whereas f is obviously initialized in the statement. I am confused by this warning.