User account creation filtered due to spam.

View | Details | Raw Unified | Return to bug 56510
Collapse All | Expand All

(-)gcc/cfgexpand.c.jj (-1 / +52 lines)
Lines 3704-3709 expand_debug_source_expr (tree exp) Link Here
3704
  return op0;
3704
  return op0;
3705
}
3705
}
3706
3706
3707
/* Ensure INSN_VAR_LOCATION_LOC (insn) doesn't have unbound complexity.
3708
   Allow 4 levels of rtl nesting for most rtl codes, and if we see anything
3709
   deeper than that, create DEBUG_EXPRs and emit DEBUG_INSNs before INSN.  */
3710
3711
static void
3712
avoid_complex_debug_insns (rtx insn, rtx *exp_p, int depth)
3713
{
3714
  rtx exp = *exp_p;
3715
  if (exp == NULL_RTX)
3716
    return;
3717
  if ((OBJECT_P (exp) && !MEM_P (exp)) || GET_CODE (exp) == CLOBBER)
3718
    return;
3719
3720
  if (depth == 4)
3721
    {
3722
      /* Create DEBUG_EXPR (and DEBUG_EXPR_DECL).  */
3723
      rtx dval = make_debug_expr_from_rtl (exp);
3724
3725
      /* Emit a debug bind insn before INSN.  */
3726
      rtx bind = gen_rtx_VAR_LOCATION (GET_MODE (exp),
3727
				       DEBUG_EXPR_TREE_DECL (dval), exp,
3728
				       VAR_INIT_STATUS_INITIALIZED);
3729
3730
      emit_debug_insn_before (bind, insn);
3731
      *exp_p = dval;
3732
      return;
3733
    }
3734
3735
  const char *format_ptr = GET_RTX_FORMAT (GET_CODE (exp));
3736
  int i, j;
3737
  for (i = 0; i < GET_RTX_LENGTH (GET_CODE (exp)); i++)
3738
    switch (*format_ptr++)
3739
      {
3740
      case 'e':
3741
	avoid_complex_debug_insns (insn, &XEXP (exp, i), depth + 1);
3742
	break;
3743
3744
      case 'E':
3745
      case 'V':
3746
	for (j = 0; j < XVECLEN (exp, i); j++)
3747
	  avoid_complex_debug_insns (insn, &XVECEXP (exp, i, j), depth + 1);
3748
	break;
3749
3750
      default:
3751
	break;
3752
      }
3753
}
3754
3707
/* Expand the _LOCs in debug insns.  We run this after expanding all
3755
/* Expand the _LOCs in debug insns.  We run this after expanding all
3708
   regular insns, so that any variables referenced in the function
3756
   regular insns, so that any variables referenced in the function
3709
   will have their DECL_RTLs set.  */
3757
   will have their DECL_RTLs set.  */
Lines 3724-3730 expand_debug_locations (void) Link Here
3724
    if (DEBUG_INSN_P (insn))
3772
    if (DEBUG_INSN_P (insn))
3725
      {
3773
      {
3726
	tree value = (tree)INSN_VAR_LOCATION_LOC (insn);
3774
	tree value = (tree)INSN_VAR_LOCATION_LOC (insn);
3727
	rtx val;
3775
	rtx val, prev_insn, insn2;
3728
	enum machine_mode mode;
3776
	enum machine_mode mode;
3729
3777
3730
	if (value == NULL_TREE)
3778
	if (value == NULL_TREE)
Lines 3753-3758 expand_debug_locations (void) Link Here
3753
	  }
3801
	  }
3754
3802
3755
	INSN_VAR_LOCATION_LOC (insn) = val;
3803
	INSN_VAR_LOCATION_LOC (insn) = val;
3804
	prev_insn = PREV_INSN (insn);
3805
	for (insn2 = insn; insn2 != prev_insn; insn2 = PREV_INSN (insn2))
3806
	  avoid_complex_debug_insns (insn2, &INSN_VAR_LOCATION_LOC (insn2), 0);
3756
      }
3807
      }
3757
3808
3758
  flag_strict_aliasing = save_strict_alias;
3809
  flag_strict_aliasing = save_strict_alias;
(-)gcc/testsuite/gcc.dg/pr56510.c.jj (+37 lines)
Line 0 Link Here
1
/* PR debug/56510 */
2
/* { dg-do compile } */
3
/* { dg-options "-O2 -g" } */
4
5
struct S { unsigned long s1; void **s2[0]; };
6
void **a, **b, **c, **d, **e, **f;
7
8
static void **
9
baz (long x, long y)
10
{
11
  void **s = f;
12
  *f = (void **) (y << 8 | (x & 0xff));
13
  f += y + 1;
14
  return s;
15
}
16
17
void bar (void);
18
void
19
foo (void)
20
{
21
  void **g = b[4];
22
  a = b[2];
23
  b = b[1];
24
  g[2] = e;
25
  void **h
26
    = ((void **************************)
27
       a)[1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][66];
28
  void **i = ((struct S *) h)->s2[4];
29
  d = baz (4, 3);
30
  d[1] = b;
31
  d[2] = a;
32
  d[3] = bar;
33
  b = d;
34
  g[1] = i[2];
35
  a = g;
36
  ((void (*) (void)) (i[1])) ();
37
}

Return to bug 56510