public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33665]  New: Warning: `this.11' is used uninitialized in this function
@ 2007-10-05  9:52 matthewc at cse dot unsw dot edu dot au
  2008-01-06 22:47 ` [Bug c++/33665] [4.1/4.2 regression] Bogus warning: `this.0' " reichelt at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: matthewc at cse dot unsw dot edu dot au @ 2007-10-05  9:52 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]

Experienced with 4.1.1, 4.1.2 and 4.2.1.  Below is the minimum test case that I
can narrow it down to while being reproducible across these versions.

$ g++ -O3 -Wall test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:19: warning: ‘this.11’ is used uninitialized in this function
test.cpp:19: note: ‘this.11’ was declared here
ws004:/tmp$ 

---

struct base1
{
    int function() { return 1; }
};

struct base2 : public base1
{
    double val1;
    double val2;
};

struct myclass : public base2
{
public:
    int x;

    myclass()
    {
        x = this->function();
    }
};

static myclass init_instance()
{
    return myclass();
}

struct test_harness
{
    const myclass instance;

    test_harness() : instance(init_instance())
    {
    }

    int result()
    {
        return instance.x;
    }
};

int main(void)
{
    test_harness x;
    return x.result();
}


-- 
           Summary: Warning: `this.11' is used uninitialized in this
                    function
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matthewc at cse dot unsw dot edu dot au
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33665


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

* [Bug c++/33665] [4.1/4.2 regression] Bogus warning: `this.0' is used uninitialized in this function
  2007-10-05  9:52 [Bug c++/33665] New: Warning: `this.11' is used uninitialized in this function matthewc at cse dot unsw dot edu dot au
@ 2008-01-06 22:47 ` reichelt at gcc dot gnu dot org
  2008-07-04 22:19 ` [Bug c++/33665] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 22:30 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-01-06 22:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from reichelt at gcc dot gnu dot org  2008-01-06 22:30 -------
Confirmed. Here's a further reduced testcase that triggers the warning
already with "-O -Wall":

================================
struct A {};

struct B : A
{
  double x, y;

  B() : x(), y() {}
};

inline B getB()
{
  return B();
}

struct C : B
{
  C() : B(getB()) {}
};

C c;
================================

bug.cc: In function 'void __static_initialization_and_destruction_0(int, int)':
bug.cc:7: warning: 'this.0' is used uninitialized in this function
bug.cc:7: note: 'this.0' was declared here

The bug appeared in GCC 4.1.2, but seems to be fixed on mainline.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-06 22:30:19
               date|                            |
            Summary|Warning: `this.11' is used  |[4.1/4.2 regression] Bogus
                   |uninitialized in this       |warning: `this.0' is used
                   |function                    |uninitialized in this
                   |                            |function
   Target Milestone|---                         |4.1.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33665


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

* [Bug c++/33665] [4.2 regression] Bogus warning: `this.0' is used uninitialized in this function
  2007-10-05  9:52 [Bug c++/33665] New: Warning: `this.11' is used uninitialized in this function matthewc at cse dot unsw dot edu dot au
  2008-01-06 22:47 ` [Bug c++/33665] [4.1/4.2 regression] Bogus warning: `this.0' " reichelt at gcc dot gnu dot org
@ 2008-07-04 22:19 ` jsm28 at gcc dot gnu dot org
  2009-03-30 22:30 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jsm28 at gcc dot gnu dot org  2008-07-04 22:18 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 regression] Bogus  |[4.2 regression] Bogus
                   |warning: `this.0' is used   |warning: `this.0' is used
                   |uninitialized in this       |uninitialized in this
                   |function                    |function
   Target Milestone|4.1.3                       |4.2.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33665


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

* [Bug c++/33665] [4.2 regression] Bogus warning: `this.0' is used uninitialized in this function
  2007-10-05  9:52 [Bug c++/33665] New: Warning: `this.11' is used uninitialized in this function matthewc at cse dot unsw dot edu dot au
  2008-01-06 22:47 ` [Bug c++/33665] [4.1/4.2 regression] Bogus warning: `this.0' " reichelt at gcc dot gnu dot org
  2008-07-04 22:19 ` [Bug c++/33665] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 22:30 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 22:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jsm28 at gcc dot gnu dot org  2009-03-30 22:30 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.1.2 4.2.0 4.2.1 4.2.2     |4.1.2 4.2.0 4.2.1 4.2.2
                   |                            |4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33665


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

end of thread, other threads:[~2009-03-30 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-05  9:52 [Bug c++/33665] New: Warning: `this.11' is used uninitialized in this function matthewc at cse dot unsw dot edu dot au
2008-01-06 22:47 ` [Bug c++/33665] [4.1/4.2 regression] Bogus warning: `this.0' " reichelt at gcc dot gnu dot org
2008-07-04 22:19 ` [Bug c++/33665] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 22:30 ` jsm28 at gcc dot gnu dot org

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).