http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60239
Bug ID: 60239 Summary: False positive maybe-uninitialized in for loop Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lcid-fire at gmx dot net The code in https://github.com/RobertBeckebans/RBDOOM-3-BFG/blob/dd9b8a8710dd7f8c1376eb245ee31fc740eae6eb/neo/renderer/tr_backend_rendertools.cpp triggers a false positive maybe-uninitialized warning. The code in question begins at line 1971: static void RB_DrawText( const char* text, const idVec3& origin, float scale, const idVec4& color, const idMat3& viewAxis, const int align ) { // <snip/> idVec3 org, p1, p2; // <snip/> for( i = 0; i < len; i++ ) { if( i == 0 || text[i] == '\n' ) { org = origin - viewAxis[2] * ( line * 36.0f * scale ); // <snip/> } org -= viewAxis[1] * ( spacing * scale ); } The error message is: idlib/../idlib/math/Vector.h: In function 'void RB_DrawText(const char*, const idVec3&, float, const idVec4&, const idMat3&, int)': idlib/../idlib/math/Vector.h:567:10: error: 'org.idVec3::x' may be used uninitialized in this function [-Werror=maybe-uninitialized] /home/andreas/Projects/bfg/neo/renderer/tr_backend_rendertools.cpp:1971:9: note: 'org.idVec3::x' was declared here idVec3 org, p1, p2; I tried to create a simple version that triggers that false positive but everything I tried analyzes the code correctly.