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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Cross ref: See also https://github.com/SOLLVE/sollve_vv/issues/41

(In reply to Jose Manuel Monsalve Diaz from comment #0)
> The problems:
> 1. DOUBLE COMPLEX values produce a compiler LTO error:

The problem is that COMPLEX(kind=16) alias COMPLEX*32 is a REAL128 complex
floating-point number, which is supported on the host – but not on the offload
target (here: nvptx-none).

I think the output by LTO is correct but not very helpful:

lto1: fatal error: unsupported mode 'XF'   (for long double)
lto1: fatal error: unsupported mode 'TF'   (for __float128)

I think when generating code for offloading, this must be more explicit like:

  nvptx-none does not support 80-bit floating-point numbers
  nvptx-none does not support 128-bit floating-point numbers

Or something along those lines which actually helps the user to understand what
goes wrong. 

Richard, Jakub:  Thoughts?


C example – untested – which illustrates the issue and can be turned into a
test case, once LTO has a nicer error.
-----------------------------------
/* { dg-do link } */
/* { dg-require-effective-target large_long_double } */
/* { dg-require-effective-target offload_device } */
/* { dg-error "fatal error: unsupported mode 'XF'" */

#include <stdlib.h>  /* For abort. */

long double foo (long double x)
{
  #pragma omp target map(tofrom:x)
    x *= 2.0;
  return x;
}

int main
{
  long double v = foo (10.0q) - 20.0q;
  if (v > 1.0e-5 || v < -1.0e-5) abort();
  return 0;
}
-----------------------------------
/* { dg-do link { target __float128 } } */
/* { dg-add-options __float128 } */
/* { dg-require-effective-target offload_device } */
/* { dg-error "fatal error: unsupported mode 'TF'" */

__float128 foo(__float128 y)
{
  #pragma omp target map(tofrom: y)
    y *= 4.0;
  return y;
}

int main
{
  __float128 v = foo (5.0L) - 20.0L;
  if (v > 1.0e-5 || v < -1.0e-5) abort();
  return 0;
}
-----------------------------------
(Assumes that for offload_device, neither data type is available; if it is, one
needs to exclude those offload-targets.)



> 2. CHARACTER default mapping not correct according to the specs.

See PR 92920.

Reply via email to