diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2021-08-20 15:12:56 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2021-08-22 11:08:26 +0200 |
commit | a5416bf369419428fb139c432bcd88f6f8ee4910 (patch) | |
tree | 5dc426a016ae6f9f0282608f2588258834736b2a /libgomp/config | |
parent | 4be4fa4ec7ffa16cb2b0e24f656ee0fcdf23b3e0 (diff) | |
download | gcc-a5416bf369419428fb139c432bcd88f6f8ee4910.zip gcc-a5416bf369419428fb139c432bcd88f6f8ee4910.tar.gz gcc-a5416bf369419428fb139c432bcd88f6f8ee4910.tar.bz2 |
Make the OpenMP 'error' directive work for nvptx offloading
... and add a minimum amount of offloading testing.
(Leaving aside that 'fwrite' to 'stderr' probably wouldn't work anyway) the
'fwrite' calls in 'libgomp/error.c:GOMP_warning', 'libgomp/error.c:GOMP_error'
drag in 'isatty', which isn't provided by my nvptx newlib build at present, so
we get, for example:
[...]
FAIL: libgomp.c/../libgomp.c-c++-common/declare_target-1.c (test for excess errors)
Excess errors:
unresolved symbol isatty
mkoffload: fatal error: [...]/build-gcc/./gcc/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
[...]
..., and many more.
Fix up for recent commit 0d973c0a0d90a0a302e7eda1a4d9709be3c5b102
"openmp: Implement the error directive".
libgomp/
* config/nvptx/error.c (fwrite, exit): Override, too.
* testsuite/libgomp.c-c++-common/error-1.c: Add a minimum amount
of offloading testing.
* testsuite/libgomp.fortran/error-1.f90: Likewise.
Diffstat (limited to 'libgomp/config')
-rw-r--r-- | libgomp/config/nvptx/error.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/libgomp/config/nvptx/error.c b/libgomp/config/nvptx/error.c index dfa75da..c55791e 100644 --- a/libgomp/config/nvptx/error.c +++ b/libgomp/config/nvptx/error.c @@ -31,12 +31,38 @@ #include <stdio.h> #include <stdlib.h> -#undef vfprintf -#undef fputs -#undef fputc +/* No 'FILE *stream's, just basic 'vprintf' etc. */ + +#undef vfprintf #define vfprintf(stream, fmt, list) vprintf (fmt, list) + +#undef fputs #define fputs(s, stream) printf ("%s", s) + +#undef fputc #define fputc(c, stream) printf ("%c", c) +#undef fwrite +#if 0 +# define fwrite(ptr, size, nmemb, stream) \ + printf ("%.*s", (int) (size * nmemb), (int) (size * nmemb), ptr) +/* ... prints literal '%.*s'. */ +#else +# define fwrite(ptr, size, nmemb, stream) \ + do { \ + /* Yuck! */ \ + for (size_t i = 0; i < size * nmemb; ++i) \ + printf ("%c", ptr[i]); \ + } while (0) +#endif + + +/* The 'exit (EXIT_FAILURE);' of an Fortran (only, huh?) OpenMP 'error' + directive with 'severity (fatal)' causes a hang, so 'abort' instead of + 'exit'. */ +#undef exit +#define exit(status) abort () + + #include "../../error.c" |