Commit 40aea05c by Zack Weinberg

varasm.c (function_section): If DECL is NULL_TREE, don't try to do anything else.

	* varasm.c (function_section): If DECL is NULL_TREE, don't try
	to do anything else.  Do not call get_insns if cfun or
	cfun->emit are NULL.

From-SVN: r89777
parent 6571df13
2004-10-28 Zack Weinberg <zack@codesourcery.com>
* varasm.c (function_section): If DECL is NULL_TREE, don't try
to do anything else. Do not call get_insns if cfun or
cfun->emit are NULL.
2004-10-28 Adam Nemet <anemet@lnxw.com> 2004-10-28 Adam Nemet <anemet@lnxw.com>
PR middle-end/18160 PR middle-end/18160
......
...@@ -563,26 +563,34 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED, ...@@ -563,26 +563,34 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
/* Switch to the section for function DECL. /* Switch to the section for function DECL.
If DECL is NULL_TREE, switch to the text section. If DECL is NULL_TREE, switch to the text section. We can be passed
??? It's not clear that we will ever be passed NULL_TREE, but it's NULL_TREE under some circumstances by dbxout.c at least. */
safer to handle it. */
void void
function_section (tree decl) function_section (tree decl)
{ {
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS if (decl == NULL_TREE)
bool unlikely = scan_ahead_for_unlikely_executed_note (get_insns()); text_section ();
else
{
/* ??? Typical use of this function maybe shouldn't be looking
for unlikely blocks at all - in the event that an entire
function is going into the unlikely-execute section, that
should be reflected in its DECL_SECTION_NAME. */
rtx insns = cfun && cfun->emit ? get_insns () : 0;
bool unlikely = insns && scan_ahead_for_unlikely_executed_note (insns);
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
targetm.asm_out.select_section (decl, unlikely, DECL_ALIGN (decl)); targetm.asm_out.select_section (decl, unlikely, DECL_ALIGN (decl));
#else #else
if (scan_ahead_for_unlikely_executed_note (get_insns())) if (unlikely)
unlikely_text_section (); unlikely_text_section ();
else if (decl != NULL_TREE else if (DECL_SECTION_NAME (decl))
&& DECL_SECTION_NAME (decl) != NULL_TREE) named_section (decl, 0, 0);
named_section (decl, (char *) 0, 0);
else else
text_section (); text_section ();
#endif #endif
}
} }
/* Switch to read-only data section associated with function DECL. */ /* Switch to read-only data section associated with function DECL. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment