This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Inconsistency between code and docs
- From: "Paulo Matos" <pmatos at broadcom dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 18 Oct 2012 15:02:23 +0000
- Subject: Inconsistency between code and docs
Hello,
I have found a strange inconsistency between code and docs for TARGET_ASM_NAMED_SECTION.
Docs say (http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gccint/File-Framework.html#index-TARGET_005fASM_005fNAMED_005fSECTION-4472):
" If decl is non-NULL, it is the VAR_DECL or FUNCTION_DECL with which this section is associated."
However, in dwarf2out.c, line 21030 we have the following code:
tree comdat_key = get_identifier (ref->info);
/* Terminate the previous .debug_macinfo section. */
dw2_asm_output_data (1, 0, "End compilation unit");
targetm.asm_out.named_section (DEBUG_MACRO_SECTION,
SECTION_DEBUG
| SECTION_LINKONCE,
comdat_key);
This passes comdat_key to named_section hook which expected either a VAR_DECL or a FUNCTION_DECL.
I noticed as I am using DECL_ATTRIBUTES inside the hook on decl and it failed with checking enabled as an IDENTIFIER_NODE (as passed by dwarf2out.c) is not a DECL.
It seems to me to be a bug of dwarf2out.c since it should maybe generate a VAR_DECL instead of an IDENTIFIER_NODE. Is this the case?
Paulo Matos