This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++ patch] PR c++/11530
> On Mon, 2003-07-28 at 09:04, Jan Hubicka wrote:
> > > On Sun, 2003-07-27 at 13:36, Jan Hubicka wrote:
> > > > Hi,
> > > > this appars to be another missing mark_used call in C++ frontend.
> > > >
> > > > Honza
> > > >
> > > > Sun Jul 27 22:35:09 CEST 2003 Jan Hubicka <jh@suse.cz>
> > > > PR c++/11530
> > > > * typeck.c (build_address): Add missing mark_used.
> > > > Index: typeck.c
> > > > ===================================================================
> > > > RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
> > > > retrieving revision 1.483
> > > > diff -c -3 -p -r1.483 typeck.c
> > > > *** typeck.c 19 Jul 2003 16:09:47 -0000 1.483
> > > > --- typeck.c 27 Jul 2003 20:34:40 -0000
> > > > *************** build_address (tree t)
> > > > *** 3804,3809 ****
> > > > --- 3804,3810 ----
> > > >
> > > > if (error_operand_p (t) || !cxx_mark_addressable (t))
> > > > return error_mark_node;
> > > > + mark_used (t);
> > > >
> > > > addr = build1 (ADDR_EXPR,
> > > > build_pointer_type (TREE_TYPE (t)),
> > >
> > > This patch is certainly incorrect, since there is no guarantee that T is
> > > a decl.
> > >
> > > What is the call stack at the point that build_address is called?
> > It comes from the build_unary_operator fromt the same file, if I recall
> > correctly.
>
> I think we need to look further, then. In general, mark_used should be
> called when the expression for the function is first parsed.
OK, another try.
The functions comes in as COMPONENT_REF, so I guess it should be makred
when COMPONENT_REF is being build, but I am not quite sure where. This
place looks like one of possiblilities. Looks better?
Tue Jul 29 00:58:29 CEST 2003 Jan Hubicka <jh@suse.cz>
* typeck.c (build_class_member_access_expr): Mark function as used.
Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.487
diff -c -3 -p -r1.487 typeck.c
*** typeck.c 27 Jul 2003 18:25:57 -0000 1.487
--- typeck.c 28 Jul 2003 22:58:16 -0000
*************** build_class_member_access_expr (tree obj
*** 1707,1712 ****
--- 1707,1715 ----
type = TREE_TYPE (functions);
else
type = unknown_type_node;
+
+ if (DECL_P (functions))
+ mark_used (functions);
/* Note that we do not convert OBJECT to the BASELINK_BINFO
base. That will happen when the function is called. */
result = build (COMPONENT_REF, type, object, member);