This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]