https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70625

            Bug ID: 70625
           Summary: [4.9/5 Regression] Memory exhaustion when building
                    specific snippet at -O2
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Keywords: memory-hog
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: armv7a-hardfloat-linux-gnueabihf, x86_64-pc-linux-gnu

armv7a-hardfloat-linux-gnueabihf-4.9.3 and x86_64-pc-linux-gnu-5.3.0 exhaust
all available memory when compiling the following snippet at -O2:

int b8, il, rc, nm;

void
h9(void)
{
  int *av = &b8;

 is:
  for (;;) {
    int vj, wk;
    int *m9 = &b8;

    if (*m9 == *av) {
      if (il == 0)
        goto is;

    di:
      continue;
      for (vj = 0; vj < 1; ++vj) {
        goto di;
      kz:
        ;
      }
    }

    for (rc = 0; rc < 2; ++rc) {
      int bc = rc ? rc : nm;
      int ud = bc ? (*av ? 0 : rc) : 1;

      if (ud != 0)
        if (*av != 0)
          goto kz;
    }

    for (wk = 0; wk < 3; ++wk)
      ++(*av);
    av = 0;
  }
}

Mostly vec- and bitmap-related calls show up in perf top:

   1.93%  cc1                 [.] bitmap_bit_p
   1.41%  cc1                 [.] pool_alloc
   1.36%  cc1                 [.] bitmap_set_bit
   1.18%  cc1                 [.] bitmap_and_compl
   1.15%  cc1                 [.] VN_INFO
   1.05%  cc1                 [.] bitmap_clear
   0.78%  cc1                 [.] bitmap_copy
   0.72%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_embed>::iterate
   0.67%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::operator[]
   0.67%  cc1                 [.] vec_safe_length<edge_def*, va_gc>
   0.67%  cc1                 [.] vec<pre_expr_d*, va_heap,
vl_embed>::operator[]
   0.65%  cc1                 [.] vec<pre_expr_d*, va_heap,
vl_embed>::quick_push
   0.64%  cc1                 [.] vec<edge_def*, va_gc, vl_embed>::length
   0.59%  cc1                 [.] bitmap_equal_p
   0.49%  cc1                 [.] vec<vn_ssa_aux*, va_heap,
vl_embed>::operator[]
   0.49%  cc1                 [.] bitmap_count_bits
   0.47%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::reserve
   0.47%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::iterate
   0.47%  cc1                 [.] vec<vn_ssa_aux*, va_heap, vl_ptr>::operator[]
   0.46%  cc1                 [.] iterative_hash_host_wide_int
   0.44%  cc1                 [.] value_id_constant_p
   0.42%  cc1                 [.] va_heap::reserve<pre_expr_d*>
   0.40%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::space
   0.39%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_embed>::space
   0.37%  cc1                 [.] vec<pre_expr_d*, va_heap,
vl_embed>::embedded_init
   0.37%  cc1                 [.] bitmap_and_into
   0.33%  cc1                 [.] vec<bitmap_head*, va_heap,
vl_ptr>::operator[]
   0.31%  cc1                 [.] vec<bitmap_head*, va_heap,
vl_embed>::operator[]
   0.30%  cc1                 [.] bitmap_empty_p
   0.28%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::safe_push
   0.23%  cc1                 [.] va_heap::release<pre_expr_d*>
   0.23%  cc1                 [.] bitmap_clear_bit
   0.22%  cc1                 [.] vec<edge_def*, va_gc, vl_embed>::operator[]
   0.21%  cc1                 [.] xrealloc
   0.20%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::release
   0.18%  cc1                 [.] vec_prefix::calculate_allocation
   0.18%  cc1                 [.] vec<basic_block_def*, va_heap,
vl_embed>::iterate
   0.17%  cc1                 [.] vec<pre_expr_d*, va_heap, vl_ptr>::quick_push

This snippet was reduced from the same source as the one from PR70623.

Reply via email to