https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110761
Bug ID: 110761 Summary: No warning for an uninitialized variable when used within its own initialization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jwzeng at nuaa dot edu.cn Target Milestone: --- Link to the Compiler Explorer: https://godbolt.org/z/ra7P3EcMn There is no warning for a variable is uninitialized when used within its own initialization. $ cat test.c int main(void) { int a = 1, b = 2; int g = (a % ((~0) && b)) && g; } $ gcc-trunk -Wall -Wextra -pedantic -c test.c $ $ clang-16.0.0 -Weverything -pedantic -c test.c test.c:4:34: warning: variable 'g' is uninitialized when used within its own initialization [-Wuninitialized] int g = (a % ((~0) && b)) && g; ~ ^ 1 warning generated. $ $ gcc-trunk -v gcc (GCC) 14.0.0 20230619 (experimental) [master r14-1917-gf8e0270272] $ clang-16.0.0 -v clang version 16.0.0 Target: x86_64-unknown-linux-gnu Would it be better to output warning information like clang? In gcc-11.4 and earlier versions, there will be corresponding warnings.