https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66447
Bug ID: 66447 Summary: -Werror=maybe-uninitialized indicates trashing of variable across longjmp Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jbowler at acm dot org Target Milestone: --- Download libpng-1.6.17.tar (this version, not the next one which will have work-round, you may have to look in the archives for this version), e.g.: ftp ftp.simplesystems.org <log in as anonymous> cd pub/png/src/libpng16 get libpng-1.6.17.tar.xz quit Extract, e.g: tar xf libpng-1.6.17.tar.xz cd libpng-1.6.17 Then: mkdir test cd test CFLAGS="-pedantic -ansi -O2 -Wall" cC=gcc-5.1.0 ../configure --enable-werror make pngvalid Expect: successful compilation of pngvalid.c Observe: ../contrib/libtests/pngvalid.c:4038:30: error: 'exception_prev_1' may be used uninitialized in this function The second error will be fixed in later versions. This one seems to be bogus; the variable (actually exception__prev, #defined to eliminate warnings about shadows) is not modified between the setjmp and the longjmp, therefore this is valid, totally conformant ANSI-C90. The "-pendantic -ansi" is unnecessary to show the problem, I just put it in because: a) That is what libpng is. b) ANSI X3.159-1989 4.6.2.1 lines 11-14; I believe the variable must be preserved across setjmp/longjmp. John Bowler