From 13b7a3938956ff273f5da8f613a724aad397c8cc Mon Sep 17 00:00:00 2001 From: rth Date: Tue, 16 May 2000 06:11:56 +0000 Subject: [PATCH] * varasm.c (output_constant_pool): Abort instead of converting (improperly) deleted labels to zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33922 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/varasm.c | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76b39815318..dd6ecb32060 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-05-15 Richard Henderson + + * varasm.c (output_constant_pool): Abort instead of converting + (improperly) deleted labels to zero. + 2000-05-16 Neil Booth * cpplex.c (parse_string2): Update comment. diff --git a/gcc/varasm.c b/gcc/varasm.c index 633688e1455..b92bf3c8156 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3781,6 +3781,8 @@ output_constant_pool (fnname, fndecl) for (pool = first_pool; pool; pool = pool->next) { + rtx tmp; + x = pool->constant; if (! pool->mark) @@ -3791,14 +3793,34 @@ output_constant_pool (fnname, fndecl) is eliminated by optimization. If so, write a constant of zero instead. Note that this can also happen by turning the CODE_LABEL into a NOTE. */ - if (((GET_CODE (x) == LABEL_REF - && (INSN_DELETED_P (XEXP (x, 0)) - || GET_CODE (XEXP (x, 0)) == NOTE))) - || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS - && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF - && (INSN_DELETED_P (XEXP (XEXP (XEXP (x, 0), 0), 0)) - || GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == NOTE))) - x = const0_rtx; + /* ??? This seems completely and utterly wrong. Certainly it's + not true for NOTE_INSN_DELETED_LABEL, but I disbelieve proper + functioning even with INSN_DELETED_P and friends. */ + + tmp = x; + switch (GET_CODE (x)) + { + case CONST: + if (GET_CODE (XEXP (x, 0)) != PLUS + || GET_CODE (XEXP (XEXP (x, 0), 0)) != LABEL_REF) + break; + tmp = XEXP (XEXP (x, 0), 0); + /* FALLTHRU */ + + case LABEL_REF: + tmp = XEXP (x, 0); + if (INSN_DELETED_P (tmp) + || (GET_CODE (tmp) == NOTE + && NOTE_LINE_NUMBER (tmp) == NOTE_INSN_DELETED)) + { + abort (); + x = const0_rtx; + } + break; + + default: + break; + } /* First switch to correct section. */ #ifdef SELECT_RTX_SECTION -- 2.11.0