This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix for PR 14838
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org, mark at codesourcery dot com, gdr at cs dot tamu dot edu
- Date: Mon, 22 Nov 2004 00:28:31 -0500 (EST)
- Subject: [patch] Fix for PR 14838
The enclosed change fixes PR 14838. It makes get_first_nonnote_insn
and get_last_nonnote_insn more conservative in that they no longer
assume that the first/last insn is always a note insn.
The only users of these two functions are pa.c and avr.c.
Tested on hppa-unknown-linux-gnu, 3.3, 3.4 and 4.0 branches with
no regressions.
Ok for 3.3, 3.4 and main?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2004-11-21 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR rtl-optimization/14838
* emit-rtl.c (get_first_nonnote_insn): Don't assume first insn is a
note.
(get_last_nonnote_insn): Don't assume last insn is a note.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.365.4.5
diff -u -3 -p -r1.365.4.5 emit-rtl.c
--- emit-rtl.c 25 Mar 2004 16:44:40 -0000 1.365.4.5
+++ emit-rtl.c 21 Nov 2004 18:56:18 -0000
@@ -2908,15 +2908,9 @@ get_last_insn_anywhere (void)
rtx
get_first_nonnote_insn (void)
{
- rtx insn = first_insn;
-
- while (insn)
- {
- insn = next_insn (insn);
- if (insn == 0 || GET_CODE (insn) != NOTE)
- break;
- }
+ rtx insn;
+ for (insn = first_insn; insn && NOTE_P (insn); insn = next_insn (insn));
return insn;
}
@@ -2926,15 +2920,9 @@ get_first_nonnote_insn (void)
rtx
get_last_nonnote_insn (void)
{
- rtx insn = last_insn;
-
- while (insn)
- {
- insn = previous_insn (insn);
- if (insn == 0 || GET_CODE (insn) != NOTE)
- break;
- }
+ rtx insn;
+ for (insn = last_insn; insn && NOTE_P (insn); insn = previous_insn (insn));
return insn;
}