Bug 51574 - ir_loop_jump constructor assigns member variable to itself
ir_loop_jump constructor assigns member variable to itself
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: glsl-compiler
unspecified
Other All
: medium normal
Assigned To: Ian Romanick
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-29 14:36 UTC by thakis
Modified: 2012-07-03 15:33 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thakis 2012-06-29 14:36:35 UTC
A very recent clang says:

../../third_party/mesa/MesaLib/src/glsl/ir.h:992:18:error: assigning member variable to itself [-Werror,-Wself-assign-memvar]
      this->loop = loop;
                 ^

Here's the whole constructor:

   ir_loop_jump(jump_mode mode)
   {
      this->ir_type = ir_type_loop_jump;
      this->mode = mode;
      this->loop = loop;
   }

From what I can tell, that line can just be deleted.
Comment 1 Ian Romanick 2012-06-29 16:46:31 UTC
Patch sent to the mesa-dev mailing list:

http://lists.freedesktop.org/archives/mesa-dev/2012-June/023488.html
Comment 2 Ian Romanick 2012-07-03 15:33:59 UTC
Fixed by

commit b1802a2115323233352da558430e109ff187b8af
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Sun Jul 1 16:21:32 2012 -0700

    glsl: Remove unused ir_loop_jump::loop pointer.
    
    Commit 0c005bd7 intended to make ir_loop_jump::mode public, but also
    accidentally added a new pointer to the enclosing loop.  Furthermore, it
    tried to initialize the new field by adding "this->loop = loop;" to the
    constructor, but since there is no loop parameter, this only initialized
    the field to itself---so it will likely be a garbage pointer.
    
    A lot of code, such as lower_jumps, allocates new loop jumps without
    setting this field appropriately, so any uses would probably just crash.
    
    Thankfully, there were none, so we can just delete the field.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51574
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>