public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60239] New: False positive maybe-uninitialized in for loop
@ 2014-02-17 11:43 lcid-fire at gmx dot net
  2014-09-18  9:41 ` [Bug c++/60239] " paolo.carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: lcid-fire at gmx dot net @ 2014-02-17 11:43 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/60239] False positive maybe-uninitialized in for loop
  2014-02-17 11:43 [Bug c++/60239] New: False positive maybe-uninitialized in for loop lcid-fire at gmx dot net
@ 2014-09-18  9:41 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-18  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60239

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-09-18
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-18  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 11:43 [Bug c++/60239] New: False positive maybe-uninitialized in for loop lcid-fire at gmx dot net
2014-09-18  9:41 ` [Bug c++/60239] " paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).