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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Minimal example:
...
int
main ()
{

  #pragma acc parallel num_gangs(256)
  {
    #pragma acc loop gang
    for (unsigned char j = 0; j < 5; j++)
      ;
  }

  return 0;
}
...

We generate an unconditional trap, thanks to pass_isolate_erroneous_paths:
...
.entry main$_omp_fn$0 (.param .u64 %in_ar0)
{
  .reg .u64 %ar0;
  ld.param.u64 %ar0,[%in_ar0];
  .reg .pred %r23;
  {
    .reg .u32 %x;
    mov.u32 %x,%tid.x;
    setp.ne.u32 %r23,%x,0;
  }
  @ %r23 bra $L2;
  trap;
  $L2:
}
...

AFAICT, the problem is that the logic that distributes the iterations over the
gangs uses signed char, while the number of gangs can be larger than what is
representable.

Reply via email to