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]

gcse.c bug fix



Hi,

The following patch stops gcse from deferencing a NULL pointer when
get_condition (loop.c) returns 0.

Cheers,

Nick.

Wed Jan 12 09:39:22 2000  Nick Burrett  <nick.burrett@btinternet.com>

	* gcse.c (delete_null_pointer_checks_1): Cope when
	get_condition cannot determine the condition.


*** gcse.c.orig Wed Jan 12 09:34:31 2000
--- gcse.c      Wed Jan 12 09:33:13 2000
*************** delete_null_pointer_checks_1 (block_reg,
*** 5131,5136 ****
--- 5131,5140 ----
        /* LAST_INSN is a conditional jump.  Get its condition.  */
        condition = get_condition (last_insn, &earliest);
  
+       /* If we can't determine the condition then skip.  */
+       if (! condition)
+       continue;
+ 
        /* Is the register known to have a nonzero value?  */
        if (!TEST_BIT (nonnull_avout[bb], block_reg[bb] - npi->min_reg))
        continue;

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