This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16315] New: [3.5 regression] Strange variable names for temporaries in warnings
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Jul 2004 14:45:57 -0000
- Subject: [Bug c++/16315] New: [3.5 regression] Strange variable names for temporaries in warnings
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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