This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16315] New: [3.5 regression] Strange variable names for temporaries in warnings


I get strange warnings on mainline when compiling the following code
snippet with "g++ -O -Wuninitialized":

===================================
struct A
{
    int i;
    A() {}
};

struct B
{
    A a;
    B(const A& x) : a(x) {}
};

B foo(bool b)
{
    if (b)
        { A a; return B(a); }
    else
        return B(A());
}
===================================

The warnings read:

warn.cc: In function `B foo(bool)':
warn.cc:10: warning: 'a$i' is used uninitialized in this function
warn.cc:10: warning: 'SR.5' is used uninitialized in this function

The variable "a$i" is related to "B(a)" in the first return statement,
whereas "SR.5" is related to "B(A())" in the second return statement.

This raises a couple of questions:
a) Shouldn't the strange names be converted to something else,
   e.g. "temporary variable"?
b) Shouldn't the constructor of A in line 4 be blamed instead of the
   constructor of B in line 10?
c) Is there a possibility to turn off this warning for the constructor
   of A? Or even: does this warningg make sense at all?

-- 
           Summary: [3.5 regression] Strange variable names for temporaries
                    in warnings
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]