https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65244
Bug ID: 65244 Summary: Bogus -Wmaybe-uninitialized warning with posix_memalign() and -Og Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ulfalizer at gmail dot com The warning posix_memalign_warn.c: In function ‘f’: posix_memalign_warn.c:9:5: warning: ‘ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized] return ptr; ^ is generated when compiling the following with gcc -Og -Wmaybe-uninitialized -c posix_memalign_warn.c No warning is produced for -O0/1/2/3/fast. #include <stdlib.h> void *f(void) { void *ptr; if (posix_memalign(&ptr, 16, 256) != 0) exit(EXIT_FAILURE); return ptr; }