This is the mail archive of the gcc-patches@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]

PATCH 14079: Fix failure to emit debug information for variables originally declared extern


In the bug report, Mark suggested either adding extern variables to the static_decls list, or fixing up the list once they're found not to be extern. I've chosen the former. static_decls is purely an optimization, so there's no harm to having a few false positives in it.

Note that this patch does not include a test case. That's because the bug it fixes is omission of debug information, and we don't have tests in the compiler test suite that check for the presence of debug info. We leave that for the gdb test suite.

Testing: bootstrapped on Linux, verified no regressions in the C++ test suite.

OK to commit to mainline and to the 3.4 branch?

--Matt


PR debug/14079
* name-lookup.c (add_decl_to_level): Add extern variables, as well as static, to static_decls array.


Index: name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.42
diff -p -r1.42 name-lookup.c
*** name-lookup.c       1 Mar 2004 06:23:38 -0000       1.42
--- name-lookup.c       6 Mar 2004 00:09:29 -0000
*************** add_decl_to_level (tree decl, cxx_scope
*** 526,534 ****
        b->names = decl;
        b->names_size++;

! /* If appropriate, add decl to separate list of statics. */
if (b->kind == sk_namespace)
! if ((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
|| (TREE_CODE (decl) == FUNCTION_DECL
&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
VARRAY_PUSH_TREE (b->static_decls, decl);
--- 526,538 ----
b->names = decl;
b->names_size++;


! /* If appropriate, add decl to separate list of statics. We
! include extern variables because they might turn out to be
! static later. It's OK for this list to contain a few false
! positives. */
if (b->kind == sk_namespace)
! if ((TREE_CODE (decl) == VAR_DECL
! && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
|| (TREE_CODE (decl) == FUNCTION_DECL
&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
VARRAY_PUSH_TREE (b->static_decls, decl);



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