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]

lcm assumes an insn is a note without testing


Caught this one with a sh-elf build with all checks enabled.  Looks
pretty obvious to me, so this hasn't undergone the standard
bootstrapping and testing procedure.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* lcm.c (optimize_mode_switching): Check whether an insn is a NOTE
	before taking its NOTE_LINE_NUMBER.

Index: gcc/lcm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/lcm.c,v
retrieving revision 1.18
diff -u -p -r1.18 lcm.c
--- gcc/lcm.c 2000/08/04 20:28:05 1.18
+++ gcc/lcm.c 2000/11/29 11:01:01
@@ -1269,7 +1269,9 @@ optimize_mode_switching (file)
 		  mode_set = gen_sequence ();
 		  end_sequence ();
 
-		  if (NOTE_LINE_NUMBER (ptr->insn_ptr) == NOTE_INSN_BASIC_BLOCK)
+		  if (GET_CODE (ptr->insn_ptr) == NOTE
+		      && (NOTE_LINE_NUMBER (ptr->insn_ptr)
+			  == NOTE_INSN_BASIC_BLOCK))
 		    emit_block_insn_after (mode_set, ptr->insn_ptr,
     		                           BASIC_BLOCK (ptr->bbnum));
 		  else

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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