PR 86416 – improve lto1 diagnostic if a mode does not exist
authorTobias Burnus <burnus@gcc.gnu.org>
Wed, 18 Dec 2019 16:51:08 +0000 (17:51 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 18 Dec 2019 16:51:08 +0000 (17:51 +0100)
        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
gcc/Makefile.in
gcc/lto-streamer-in.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c/pr86416-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/pr86416-2.c [new file with mode: 0644]

index 4e969790714b4086ce06ca27a1a8598b3386bb66..642faea1e44f063e448f328cd7784531d7ddea41 100644 (file)
@@ -1,3 +1,10 @@
+2019-12-18  Tobias Burnus  <tobias@codesourcery.com>
+
+       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  <wdijkstr@arm.com>
 
        * 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  <hubicka@ucw.cz>
            Martin Jambor  <mjambor@suse.cz>
index 6b857bd75debe32668dbef505f0f85e651c8b93d..657488d416b5a0b2f574d5c0cf6c4c2d99fdf29d 100644 (file)
@@ -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
index 675e1a7a15343cf37fbb28b3ee8a08ee7163fd62..f49f38df6472346211f630e5455f6ae69b75ddfd 100644 (file)
@@ -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;
            }
        }
index b46a68255dfe344f8672eb43cff27a3584e2bbdc..3c834175a294f847bdd31abc4b956069b607aace 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-18  Tobias Burnus  <tobias@codesourcery.com>
+
+       PR middle-end/86416
+       * testsuite/libgomp.c/pr86416-1.c: New.
+       * testsuite/libgomp.c/pr86416-2.c: New.
+
 2019-12-17  Tobias Burnus  <tobias@codesourcery.com>
 
        * 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 (file)
index 0000000..4ab523d
--- /dev/null
@@ -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 <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;
+}
diff --git a/libgomp/testsuite/libgomp.c/pr86416-2.c b/libgomp/testsuite/libgomp.c/pr86416-2.c
new file mode 100644 (file)
index 0000000..f104da7
--- /dev/null
@@ -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 <stdlib.h>  /* 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;
+}