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

--- Comment #11 from Tom de Vries <vries at gcc dot gnu.org> ---
Rewriting the test-case like this triggers the ICE without -Wreturn-type being
active:
...
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* This code uses nvptx inline assembly guarded with acc_on_device, which is
   not optimized away at -O0, and then confuses the target assembler.
   { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */

#include <assert.h>
#include <openacc.h>

#define N 100

#define GANG_ID(I)                                              \
  (acc_on_device (acc_device_nvidia)                            \
   ? ({unsigned __r;                                            \
       __asm__ volatile ("mov.u32 %0,%%ctaid.x;" : "=r" (__r)); \
       __r; }) : (I))

int
main ()
{
  int a[N];
  int i, x;
  int c;

  c = 1;
#pragma acc parallel loop gang (static:*) num_gangs (10)
  for (i = 0; i < 100; i++)
    a[i] = GANG_ID (i);

  if (c)
    __builtin_unreachable ();

#pragma acc parallel loop gang (static:1) num_gangs (10)
  for (i = 0; i < 100; i++)
    a[i] = GANG_ID (i);


  return 0;
}
...

Reply via email to