This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: uninitialized var in decl.c (make_typename_type)
- To: egcs-patches at egcs dot cygnus dot com
- Subject: C++ PATCH: uninitialized var in decl.c (make_typename_type)
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Wed, 02 Jun 1999 11:57:43 +0100
- Organization: University of Bristol
- Reply-To: nathan at compsci dot bristol dot ac dot uk
Hi,
attached is a patch to make_typename_type (decl.c), which elicited a `t might
be used uninitialized' when building the mainline. That warning looks right to
me, and I've rearranged things so it doesn't happen.
Ok to install?
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
1999-06-01 Nathan Sidwell <nathan@acm.org>
* decl.c (make_typename_type): Don't rely on unitialized
variable.
Index: egcs/gcc/cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.368
diff -c -3 -p -r1.368 decl.c
*** decl.c 1999/05/30 14:41:33 1.368
--- decl.c 1999/06/01 17:08:03
*************** tree
*** 5516,5522 ****
make_typename_type (context, name)
tree context, name;
{
- tree t;
tree fullname;
if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
--- 5516,5521 ----
*************** make_typename_type (context, name)
*** 5576,5589 ****
}
else
{
! if (IS_AGGR_TYPE (context))
! t = lookup_field (context, name, 0, 1);
! else
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
if (t)
return TREE_TYPE (t);
}
--- 5575,5589 ----
}
else
{
! tree t;
!
! if (!IS_AGGR_TYPE (context))
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
+ t = lookup_field (context, name, 0, 1);
if (t)
return TREE_TYPE (t);
}
*************** make_typename_type (context, name)
*** 5591,5597 ****
/* If the CONTEXT is not a template type, then either the field is
there now or its never going to be. */
! if (!uses_template_parms (context) && !t)
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
--- 5591,5597 ----
/* If the CONTEXT is not a template type, then either the field is
there now or its never going to be. */
! if (!uses_template_parms (context))
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;