summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-26 16:35:59 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-26 16:35:59 +0000
commita723d770e5eb185121f185cde2c3967cd7f522ad (patch)
tree4d8ef73432939ab23974a48757410751072dd8af
parent702897c30e7f6c847bf5031d37ab173297c43c70 (diff)
downloadgcc-a723d770e5eb185121f185cde2c3967cd7f522ad.tar.gz
* varasm.c (assemble_external): Assert this function is only called
during or after expanding to RTL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185812 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/varasm.c14
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 697b5b1f345..c1628b73dc5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-26 Steven Bosscher <steven@gcc.gnu.org>
+
+ * varasm.c (assemble_external): Assert this function is only called
+ during or after expanding to RTL.
+
2012-03-26 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50052
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 9bead9b10f2..26f22ddcb1c 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2166,12 +2166,18 @@ static GTY(()) tree weak_decls;
void
assemble_external (tree decl ATTRIBUTE_UNUSED)
{
- /* Because most platforms do not define ASM_OUTPUT_EXTERNAL, the
- main body of this code is only rarely exercised. To provide some
- testing, on all platforms, we make sure that the ASM_OUT_FILE is
- open. If it's not, we should not be calling this function. */
+ /* Make sure that the ASM_OUT_FILE is open.
+ If it's not, we should not be calling this function. */
gcc_assert (asm_out_file);
+ /* This function should only be called if we are expanding, or have
+ expanded, to RTL.
+ Ideally, only final.c would be calling this function, but it is
+ not clear whether that would break things somehow. See PR 17982
+ for further discussion. */
+ gcc_assert (cgraph_state == CGRAPH_STATE_EXPANSION
+ || cgraph_state == CGRAPH_STATE_FINISHED);
+
if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
return;