Simple testcase: --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--
#include <errno.h> #include <unistd.h> int testfunc(void) { int ret; while (1) { const unsigned int MY_BUF_SIZE = 20; char buf[MY_BUF_SIZE]; if (read(0, buf, sizeof(buf)) < 0) { ret = errno; goto bail; } } bail: return ret; } --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- With gcc 4.4.3 I get: $ gcc -Wextra -Wall -Os -c test.c test.c: In function testfunc: test.c:6: warning: ret may be used uninitialized in this function $ gcc -Wextra -Wall -c test.c $ gcc -Wextra -Wall -O -c test.c $ gcc -Wextra -Wall -O2 -c test.c gcc 4.3.2 did not show this issue. -- Summary: Invalid "may be used uninitialized in this function" warning with -Os Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rwahl at gmx dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43459