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]

Re: [PR debug/53682] avoid crash in cselib promote_debug_loc


On Wed, Jun 20, 2012 at 12:39:29AM -0300, Alexandre Oliva wrote:
> When promote_debug_loc was first introduced, it would never be called
> with a NULL loc list.  However, because of the strategy of temporarily
> resetting loc lists before recursion introduced a few months ago in
> alias.c, the earlier assumption no longer holds.
> 
> This patch adusts promote_debug_loc to deal with this case.

The thing I'm worried about is what will happen with -g0 in that case.
If the loc list is temporarily reset, it will be restored again,
won't that mean that for -g0 we'll then have a loc that is in the
corresponding -g compilation referenced by a DEBUG_INSNs only (and thus
non-promoted)?

> for  gcc/ChangeLog
> from  Alexandre Oliva  <aoliva@redhat.com>
> 
> 	PR debug/53682
> 	* cselib.c (promote_debug_loc): Don't crash on NULL argument.
> 
> Index: gcc/cselib.c
> ===================================================================
> --- gcc/cselib.c.orig	2012-06-17 22:52:27.740087279 -0300
> +++ gcc/cselib.c	2012-06-18 08:55:32.948832112 -0300
> @@ -322,7 +322,7 @@ new_elt_loc_list (cselib_val *val, rtx l
>  static inline void
>  promote_debug_loc (struct elt_loc_list *l)
>  {
> -  if (l->setting_insn && DEBUG_INSN_P (l->setting_insn)
> +  if (l && l->setting_insn && DEBUG_INSN_P (l->setting_insn)
>        && (!cselib_current_insn || !DEBUG_INSN_P (cselib_current_insn)))
>      {
>        n_debug_values--;

	Jakub


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