[Bug c/109530] New: Warning "is used uninitialized" raised for an initialized variable.
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 #include 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: : In function 'func2': :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.
[Bug c/108201] New: Warning about conversion from unsigned int to unsigned int
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108201 Bug ID: 108201 Summary: Warning about conversion from unsigned int to unsigned int 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: --- On a Linux x86_64 system, with GCC 12.2.0, when I build the following program with -Wsign-conversion , typedef unsigned int m_string_unicode_t; void decode(char c, m_string_unicode_t *unicode) { *unicode = ((*unicode << 6)) | ((m_string_unicode_t) c); } void decode2(char c, unsigned int *unicode) { *unicode = ((*unicode << 6)) | ((unsigned int) c); } I get the following wanning: tst.c: In function 'decode': tst.c:6:32: warning: conversion to 'm_string_unicode_t' {aka 'unsigned int'} from 'unsigned int' may change the sign of the result [-Wsign-conversion] There is a warning for the function decode, but not for the function decode2. I don't understand the warning as there is no conversion from unsigned int to unsigned int as both are the same type. I was expecting no warning for both functions. The warning only appears with GCC 12 (no issue with GCC 11).
[Bug c/53769] [C11]: Macros __STDC_NO_THREADS__ / __STDC_NO_ATOMIC__ missing.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 Patrick Pelissier changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #12 from Patrick Pelissier --- stdc-predef.h fixes the issue.