[Bug debug/66716] gomp4: libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c -g ICE

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 30 23:44:00 GMT 2015


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

--- Comment #1 from vries at gcc dot gnu.org ---
before try_transform_to_exit_first_loop_alt:
...
  <bb 9>:
  .omp_data_i_45 = &.omp_data_arr.11;
  # DEBUG .omp_data_i => .omp_data_i_45
  __ganglocal_ptr.10_47 = __builtin_GOACC_get_ganglocal_ptr ();
  # DEBUG ii => 0
  # DEBUG ii => 0
  _50 = .omp_data_i_45->c;
  c.6_51 = *_50;
  _55 = .omp_data_i_45->a;
  a.7_56 = *_55;
  _61 = .omp_data_i_45->b;
  b.8_62 = *_61;

  <bb 10>:
  # ivtmp_19 = PHI <ivtmp_7(11), 0(9)>
  ii_36 = ivtmp_19;
  # DEBUG ii => ii_36
  _52 = (long unsigned int) ii_36;
  _53 = _52 * 4;
  _54 = c.6_51 + _53;
  _59 = a.7_56 + _53;
  _60 = *_59;
  _65 = b.8_62 + _53;
  _66 = *_65;
  _67 = _60 + _66;
  *_54 = _67;
  ii_69 = ii_36 + 1;
  # DEBUG ii => ii_69
  # DEBUG ii => ii_69
  if (ivtmp_19 < 524287)
    goto <bb 11>;
  else
    goto <bb 12>;

  <bb 11>:
  ivtmp_7 = ivtmp_19 + 1;
  goto <bb 10>;
...

after try_transform_to_exit_first_loop_alt:
...
  <bb 9>:
  .omp_data_i_45 = &.omp_data_arr.11;
  # DEBUG .omp_data_i => .omp_data_i_45
  __ganglocal_ptr.10_47 = __builtin_GOACC_get_ganglocal_ptr ();
  # DEBUG ii => 0
  # DEBUG ii => 0
  _50 = .omp_data_i_45->c;
  c.6_51 = *_50;
  _55 = .omp_data_i_45->a;
  a.7_56 = *_55;
  _61 = .omp_data_i_45->b;
  b.8_62 = *_61;
  goto <bb 19>;

  <bb 10>:
  # ivtmp_19 = PHI <ivtmp_35(19)>
  ii_36 = ivtmp_19;
  # DEBUG ii => ii_36
  _52 = (long unsigned int) ii_36;
  _53 = _52 * 4;
  _54 = c.6_51 + _53;
  _59 = a.7_56 + _53;
  _60 = *_59;
  _65 = b.8_62 + _53;
  _66 = *_65;
  _67 = _60 + _66;
  *_54 = _67;
  ii_69 = ii_36 + 1;
  goto <bb 11>;

  <bb 19>:
  # ivtmp_35 = PHI <ivtmp_7(11), 0(9)>
  # DEBUG ii => ii_69
  # DEBUG ii => ii_69
  if (ivtmp_35 < 524288)
    goto <bb 10>;
  else
    goto <bb 12>;

  <bb 11>:
  ivtmp_7 = ivtmp_19 + 1;
  goto <bb 19>;
...

And also after try_transform_to_exit_first_loop_alt:
...
(gdb) call verify_ssa (1,1)
src/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c:
In function ‘main’:
src/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c:41:1:
error: definition in block 10 does not dominate use in block 19
for SSA_NAME: ii_69 in statement:
# DEBUG ii => ii_69
src/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c:41:1:
internal compiler error: verify_ssa failed
...

So, we seem to be including some debug_insns when splitting the cond from the
loop body. That seems to be due to using split_block_before_cond_jump:
...
static basic_block
gimple_split_block_before_cond_jump (basic_block bb)
{
  gimple last, split_point;
  gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb);
  if (gsi_end_p (gsi))
    return NULL;
  last = gsi_stmt (gsi);
  if (gimple_code (last) != GIMPLE_COND
      && gimple_code (last) != GIMPLE_SWITCH)
    return NULL;
  gsi_prev_nondebug (&gsi);
  split_point = gsi_stmt (gsi);
  return split_block (bb, split_point)->dest;
}
...

This patch might fix the problem:
...
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 99b27c7..a8aec26 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -5837,7 +5837,7 @@ gimple_split_block_before_cond_jump (basic_block bb)
   if (gimple_code (last) != GIMPLE_COND
       && gimple_code (last) != GIMPLE_SWITCH)
     return NULL;
-  gsi_prev_nondebug (&gsi);
+  gsi_prev (&gsi);
   split_point = gsi_stmt (gsi);
   return split_block (bb, split_point)->dest;
 }
...

It seems that parloops try_transform_to_exit_first_loop_alt is the first user
of split_block_before_cond_jump.


More information about the Gcc-bugs mailing list