From c80c9e26dec56891897be0e468c004a588bedceb Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Wed, 18 Dec 2019 17:51:08 +0100 Subject: [PATCH] =?utf8?q?PR=2086416=20=E2=80=93=20improve=20lto1=20diagno?= =?utf8?q?stic=20if=20a=20mode=20does=20not=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR middle-end/86416 * Makefile.in (CFLAGS-lto-streamer-in.o): Pass target_noncanonical on. * lto-streamer-in.c (lto_input_mode_table): Improve unsupported-mode diagnostic. PR middle-end/86416 * testsuite/libgomp.c/pr86416-1.c: New. * testsuite/libgomp.c/pr86416-2.c: New. From-SVN: r279528 --- gcc/ChangeLog | 9 ++++++++- gcc/Makefile.in | 2 ++ gcc/lto-streamer-in.c | 26 ++++++++++++++++++++++++- libgomp/ChangeLog | 6 ++++++ libgomp/testsuite/libgomp.c/pr86416-1.c | 22 +++++++++++++++++++++ libgomp/testsuite/libgomp.c/pr86416-2.c | 22 +++++++++++++++++++++ 6 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 libgomp/testsuite/libgomp.c/pr86416-1.c create mode 100644 libgomp/testsuite/libgomp.c/pr86416-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e969790714..642faea1e44 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-12-18 Tobias Burnus + + PR middle-end/86416 + * Makefile.in (CFLAGS-lto-streamer-in.o): Pass target_noncanonical on. + * lto-streamer-in.c (lto_input_mode_table): Improve unsupported-mode + diagnostic. + 2019-12-18 Wilco Dijkstra * config/aarch64/aarch64-cores.def: @@ -11,7 +18,7 @@ PR ipa/92971 * ipa-cp.c (cgraph_edge_brings_all_agg_vals_for_node): Fix - definition of values, release memory on exit. + definition of values, release memory on exit. 2019-12-17 Jan Hubicka Martin Jambor diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 6b857bd75de..657488d416b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2244,6 +2244,8 @@ version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE) # lto-compress.o needs $(ZLIBINC) added to the include flags. CFLAGS-lto-compress.o += $(ZLIBINC) +CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\" + bversion.h: s-bversion; @true s-bversion: BASE-VER echo "#define BUILDING_GCC_MAJOR `echo $(BASEVER_c) | sed -e 's/^\([0-9]*\).*$$/\1/'`" > bversion.h diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 675e1a7a153..f49f38df647 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1698,7 +1698,31 @@ lto_input_mode_table (struct lto_file_decl_data *file_data) } /* FALLTHRU */ default: - fatal_error (UNKNOWN_LOCATION, "unsupported mode %qs", mname); + /* This is only used for offloading-target compilations and + is a user-facing error. Give a better error message for + the common modes; see also mode-classes.def. */ + if (mclass == MODE_FLOAT) + fatal_error (UNKNOWN_LOCATION, + "%s - %u-bit-precision floating-point numbers " + "unsupported (mode %qs)", TARGET_MACHINE, + prec.to_constant (), mname); + else if (mclass == MODE_DECIMAL_FLOAT) + fatal_error (UNKNOWN_LOCATION, + "%s - %u-bit-precision decimal floating-point " + "numbers unsupported (mode %qs)", TARGET_MACHINE, + prec.to_constant (), mname); + else if (mclass == MODE_COMPLEX_FLOAT) + fatal_error (UNKNOWN_LOCATION, + "%s - %u-bit-precision complex floating-point " + "numbers unsupported (mode %qs)", TARGET_MACHINE, + prec.to_constant (), mname); + else if (mclass == MODE_INT) + fatal_error (UNKNOWN_LOCATION, + "%s - %u-bit integer numbers unsupported (mode " + "%qs)", TARGET_MACHINE, prec.to_constant (), mname); + else + fatal_error (UNKNOWN_LOCATION, "%s - unsupported mode %qs", + TARGET_MACHINE, mname); break; } } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index b46a68255df..3c834175a29 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2019-12-18 Tobias Burnus + + PR middle-end/86416 + * testsuite/libgomp.c/pr86416-1.c: New. + * testsuite/libgomp.c/pr86416-2.c: New. + 2019-12-17 Tobias Burnus * config/accel/openacc.f90 (module openacc_kinds): Use 'PUBLIC' to mark diff --git a/libgomp/testsuite/libgomp.c/pr86416-1.c b/libgomp/testsuite/libgomp.c/pr86416-1.c new file mode 100644 index 00000000000..4ab523d2310 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr86416-1.c @@ -0,0 +1,22 @@ +/* { dg-do link } */ +/* { dg-require-effective-target large_long_double } */ + +/* PR middle-end/86416 */ +/* { dg-error "bit-precision floating-point numbers unsupported .mode '.F'." "" { target offload_device } 0 } */ +/* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { target offload_device } } */ + +#include /* 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; +} diff --git a/libgomp/testsuite/libgomp.c/pr86416-2.c b/libgomp/testsuite/libgomp.c/pr86416-2.c new file mode 100644 index 00000000000..f104da78029 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr86416-2.c @@ -0,0 +1,22 @@ +/* { dg-do link { target __float128 } } */ +/* { dg-add-options __float128 } */ + +/* PR middle-end/86416 */ +/* { dg-error "bit-precision floating-point numbers unsupported .mode '.F'." "" { target offload_device } 0 } */ +/* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { target offload_device } } */ + +#include /* For abort. */ + +__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; +} -- 2.30.2