This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DWARF question/inlining/local classes
- From: Geoff Keating <geoffk at geoffk dot org>
- To: mark at codesourcery dot com
- Cc: gcc at gcc dot gnu dot org
- Date: 30 Oct 2002 16:44:12 -0800
- Subject: Re: DWARF question/inlining/local classes
- References: <200210310010.g9V0AsU17674@gandalf.codesourcery.com>
Mark Mitchell <mark@codesourcery.com> writes:
> PR 8391 contains this code:
>
> inline void h(const Outer &o)
> {
> struct Local : public Outer::Inner {
> virtual bool f() {};
> };
> Local l;
> o.g(l);
> }
>
> When we try to emit the body of Local::f (the function in the struct
> inside h), we don't actually emit assembly code because of this code
> in rest_of_compilation:
>
> /* If this is nested inside an inlined external function, pretend
> it was only declared. Since we cannot inline such functions,
> generating code for this one is not only not necessary but will
> confuse some debugging output writers. */
> for (parent = DECL_CONTEXT (current_function_decl);
> parent != NULL_TREE;
> parent = get_containing_scope (parent))
> if (TREE_CODE (parent) == FUNCTION_DECL
> && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
> {
> DECL_INITIAL (decl) = 0;
> goto exit_rest_of_compilation;
> }
>
> This logic is wrong for C++; we need to emit Local::f.
I believe the rationale behind this code is that Local::f can't be
used from this translation unit, since the function won't be inlined.
It will be emitted when the out-of-line copy of the function is emitted.
Will this function really not be inlined? That may be the real problem.
--
- Geoffrey Keating <geoffk@geoffk.org>