This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: Robustify get_insns()
- From: Nick Clifton <nickc at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 28 Sep 2009 11:00:06 +0100
- Subject: RFA: Robustify get_insns()
Hi Guys,
I have another small patch that I would like to apply, this time to
prevent get_insns() from generating a seg-fault if it is called when
there are no insns to get.
Tested without regressions on an i686-pc-linux-gnu bootstrap.
OK to apply ?
Cheers
Nick
gcc/ChangeLog
2009-09-28 Nick Clifton <nickc@redhat.com>
* get_insns: Return NULL_RTX if there are no insns available.
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c (revision 152230)
+++ gcc/emit-rtl.c (working copy)
@@ -2870,6 +2870,8 @@
rtx
get_insns (void)
{
+ if (crtl == NULL)
+ return NULL_RTX;
return first_insn;
}