[Bug fortran/66633] [5/6 regression] ICE on valid "verify_gimple failed" with OpenMP

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 26 09:12:00 GMT 2015


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

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
The error mark is inserted by omp-low.c:omp_copy_decl for FRAME.1:

spl ()
{
  static real(kind=8) fli (void);
  struct FRAME.spl FRAME.1;

  __builtin_init_trampoline (&FRAME.1.fli, fli, &FRAME.1);
  #pragma omp parallel
    {
      void * D.3392;
      real(kind=8) (*<T8cb>) (void) D.3393;
      integer(kind=4) D.3387;
      struct __st_parameter_dt dt_parm.0;

      try
        {
          dt_parm.0.common.filename = &"pr66633.f90"[1]{lb: 1 sz: 1};
          dt_parm.0.common.line = 5;
          dt_parm.0.common.flags = 128;
          dt_parm.0.common.unit = 0;
          _gfortran_st_write (&dt_parm.0);
          {
            integer(kind=4) D.3386;

            try
              {
                D.3392 = __builtin_adjust_trampoline (&FRAME.1.fli);
                D.3393 = (real(kind=8) (*<T8cb>) (void)) D.3392;
                D.3387 = igrt (D.3393);
                D.3386 = D.3387;
                _gfortran_transfer_integer_write (&dt_parm.0, &D.3386, 4);
              }
            finally
              {
                D.3386 = {CLOBBER};
              }
          }
          _gfortran_st_write_done (&dt_parm.0);
        }
      finally
        {
          dt_parm.0 = {CLOBBER};
        }
    }
}

because the variable is not marked as shared.  For an equivalent C testcase:

void foo (int i)
{
  void nested (char c)
  {
    i = i + c;
  }

  void (*ptr)(char) = &nested;

  #pragma omp parallel
  {
    char a[i];
    ptr (a[0]);
  }
}

the FRAME.3 variable is marked as shared:

foo (int i)
{
  void * D.1866;
  void (*<T3d7>) (char) D.1867;
  static void nested (char);
  void (*<T3d7>) (char) ptr;
  struct FRAME.foo FRAME.3;
  int i [value-expr: FRAME.3.i];

  FRAME.3.i = i;
  __builtin_init_trampoline (&FRAME.3.nested, nested, &FRAME.3);
  D.1866 = __builtin_adjust_trampoline (&FRAME.3.nested);
  D.1867 = (void (*<T3d7>) (char)) D.1866;
  ptr = D.1867;
  #pragma omp parallel shared(FRAME.3) shared(ptr) shared(i)
    {
      int i.0;
      long int D.1841;
      long int D.1842;
      sizetype D.1843;
      sizetype D.1844;
      bitsizetype D.1845;
      bitsizetype D.1846;
      sizetype D.1847;
      sizetype D.1848;
      bitsizetype D.1849;
      bitsizetype D.1850;
      sizetype D.1851;
      char[0:D.1843] * a.1;
      char D.1853;
      int D.1854;
      void * saved_stack.2;

      {
        char a[0:D.1843] [value-expr: *a.1];

        saved_stack.2 = __builtin_stack_save ();
        try
          {
            i.0 = i;
            D.1841 = (long int) i.0;
            D.1842 = D.1841 + -1;
            D.1843 = (sizetype) D.1842;
            D.1844 = (sizetype) i.0;
            D.1845 = (bitsizetype) D.1844;
            D.1846 = D.1845 * 8;
            D.1847 = (sizetype) i.0;
            D.1848 = (sizetype) i.0;
            D.1849 = (bitsizetype) D.1848;
            D.1850 = D.1849 * 8;
            D.1851 = (sizetype) i.0;
            a.1 = __builtin_alloca_with_align (D.1851, 8);
            D.1853 = *a.1[0];
            D.1854 = (int) D.1853;
            ptr (D.1854);
          }
        finally
          {
            __builtin_stack_restore (saved_stack.2);
          }
      }
    }
}



More information about the Gcc-bugs mailing list