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]

Avoid dereference of null pointer in resolve_fixup_regions


The test case is below, when compiled with -O1 -gnatn on Alpha/VMS:

Tested on i686-pc-linux-gnu.

package body Test_Get is

   procedure Get (Data : out Record_Type) is
      Tmp : Record_Type;
   begin
      Data := Tmp;
   exception
      when others =>
         null;
   end Get;

   procedure Get is
      Elt : Record_Type;
   begin
      Get (Elt);
   exception
      when others =>
        null;
   end Get;

end Test_Get;
package Test_Get is

   type Record_Type is null record;

   procedure Get (Data : out Record_Type);

   procedure Get;
   pragma inline (Get);

end Test_Get;

2003-04-15  Olivier Hainque <hainque at act-europe dot fr>

	* except.c (resolve_fixup_regions): Avoid dereferencing null pointer
	to region, possible after integration of function with unreachable
	regions that were optimized away.

*** gcc/except.c	2 Apr 2003 17:58:38 -0000	1.238
--- gcc/except.c	11 Apr 2003 21:56:30 -0000
*************** resolve_fixup_regions ()
*** 914,918 ****
  	{
  	  cleanup = cfun->eh->region_array[j];
! 	  if (cleanup->type == ERT_CLEANUP
  	      && cleanup->u.cleanup.exp == fixup->u.fixup.cleanup_exp)
  	    break;
--- 914,918 ----
  	{
  	  cleanup = cfun->eh->region_array[j];
! 	  if (cleanup && cleanup->type == ERT_CLEANUP
  	      && cleanup->u.cleanup.exp == fixup->u.fixup.cleanup_exp)
  	    break;


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