Fix a few use-after-free issues

Jakub Jelinek jakub@redhat.com
Mon Mar 21 17:50:00 GMT 2011


On Mon, Mar 21, 2011 at 11:37:16AM -0600, Jeff Law wrote:
> Similarly for redirect_edge_succ_nodup in this fragment:
> 
>         ret = redirect_edge_succ_nodup (e, dest);
>         if (dump_file)
>   	fprintf (dump_file, "Fallthru edge %i->%i redirected to %i\n",
>  		 e->src->index, e->dest->index, dest->index);
>       }
> Luckily in this case the use-after-free only occurs when dumping, so it
> won't typically affect end users.

Well, the message is wrong anyway, becase e->dest->index will be
dest->index (with the exception that e has been remove_edge, but then it is
the use after free).  Guess the message should be printed before the
redirect_edge_succ_nodup call, or remember e->dest->index in some local
variable and print that variable after the call.

	Jakub



More information about the Gcc-patches mailing list