[Bug tree-optimization/65419] incorrect sibcalls to libgomp functions

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 27 09:37:00 GMT 2015


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

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-05-27
          Component|fortran                     |tree-optimization
     Ever confirmed|0                           |1

--- Comment #3 from vries at gcc dot gnu.org ---
Occurs on gomp-4_0-branch.

Minimal testcase in c:
...
$ cat src/libgomp/testsuite/libgomp.oacc-c-c++-common/data-end-sib-call.c
/* { dg-do run } */
/* { dg-options "-O2" } */

void
__attribute__((noinline,noclone))
f (void)
{
  int i;

#pragma acc data copyout (i)
  {

  }
}

int
main (void)
{
  f ();

  return 0;
}
...

The execution test passes on the host, but not on host_nonshm:
...
PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/data-end-sib-call.c
-DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 execution test
FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/data-end-sib-call.c
-DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 execution test
...

The problem is in the declaration of GOACC_data_start:
...
DEF_GOACC_BUILTIN_FNSPEC (BUILT_IN_GOACC_DATA_START, "GOACC_data_start",
                          BT_FN_VOID_INT_SIZE_PTR_PTR_PTR,
                          ATTR_FNSPEC_DOT_DOT_r_r_r_NOTHROW_LIST,
                          ATTR_NOTHROW_LIST, "..rrr")
...

[ There's a problem with the matching.  The rs in "..rrr" were supposed to
match the PTR_PTR_PTR arguments. But that's not the case, since we need to add
a dot even for a void result. So the intended spec string was "...rrr".
AFAIU, this problem does not affect this PR. But I will review omp-builtins.def
for similar problems. ]

The 'r' means NOCLOBBER and NOESCAPE.

However, we take the address of 'i', assign it to .omp_data_arr.1 and pass that
to GOACC_data_start:
...
f ()
{
  int i;
  struct .omp_data_t.0 .omp_data_arr.1;
  static long unsigned int .omp_data_sizes.2[1] = {4};
  static short unsigned int .omp_data_kinds.3[1] = {642};

  <bb 2>:
  .omp_data_arr.1.i = &i;
  __builtin_GOACC_data_start (-1, 1, &.omp_data_arr.1, &.omp_data_sizes.2,
&.omp_data_kinds.3);
...

'i' escapes and is overwritten in __builtin_GOACC_data_start, so NOCLOBBER and
NOESCAPE do not hold.



More information about the Gcc-bugs mailing list