Handle -fdiagnostics-color in lto
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Feb 2016 07:04:08 +0000 (07:04 +0000)
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Feb 2016 07:04:08 +0000 (07:04 +0000)
2016-02-09  Tom de Vries  <tom@codesourcery.com>

PR lto/69707
* lto-wrapper.c (append_diag_options): New function.
(compile_offload_image): Call append_diag_options.

* testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233237 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/lto-wrapper.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c [new file with mode: 0644]

index c82167b..8006790 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-09  Tom de Vries  <tom@codesourcery.com>
+
+       PR lto/69707
+       * lto-wrapper.c (append_diag_options): New function.
+       (compile_offload_image): Call append_diag_options.
+
 2016-02-08  Sandra Loosemore <sandra@codesourcery.com>
 
        PR other/69722
index 6a337a0..ed20b4e 100644 (file)
@@ -540,6 +540,36 @@ append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts,
     }
 }
 
+/* Append diag options in OPTS with length COUNT to ARGV_OBSTACK.  */
+
+static void
+append_diag_options (obstack *argv_obstack, struct cl_decoded_option *opts,
+                    unsigned int count)
+{
+  /* Append compiler driver arguments as far as they were merged.  */
+  for (unsigned int j = 1; j < count; ++j)
+    {
+      struct cl_decoded_option *option = &opts[j];
+
+      switch (option->opt_index)
+       {
+       case OPT_fdiagnostics_color_:
+       case OPT_fdiagnostics_show_caret:
+       case OPT_fdiagnostics_show_option:
+       case OPT_fdiagnostics_show_location_:
+       case OPT_fshow_column:
+         break;
+       default:
+         continue;
+       }
+
+      /* Pass the option on.  */
+      for (unsigned int i = 0; i < option->canonical_option_num_elements; ++i)
+       obstack_ptr_grow (argv_obstack, option->canonical_option[i]);
+    }
+}
+
+
 /* Append linker options OPTS to ARGV_OBSTACK.  */
 
 static void
@@ -721,6 +751,7 @@ compile_offload_image (const char *target, const char *compiler_path,
       /* Append options from offload_lto sections.  */
       append_compiler_options (&argv_obstack, compiler_opts,
                               compiler_opt_count);
+      append_diag_options (&argv_obstack, linker_opts, linker_opt_count);
 
       /* Append options specified by -foffload last.  In case of conflicting
         options we expect offload compiler to choose the latest.  */
index 5864d51..9de67f2 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-09  Tom de Vries  <tom@codesourcery.com>
+
+       PR lto/69707
+       * testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c: New test.
+
 2016-02-02  Alexander Monakov  <amonakov@ispras.ru>
 
        * testsuite/libgomp.c/target-31.c: Fix testcase.
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c
new file mode 100644 (file)
index 0000000..eea8c7e
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run { target { openacc_nvidia_accel_selected && lto } } } */
+/* { dg-additional-options "-flto -fno-use-linker-plugin" } */
+
+/* Worker and vector size checks.  Picked an outrageously large
+   value.  */
+
+int main ()
+{
+#pragma acc parallel num_workers (2<<20) /* { dg-error "using num_workers" } */
+  {
+  }
+
+#pragma acc parallel vector_length (2<<20) /* { dg-error "using vector_length" } */
+  {
+  }
+
+  return 0;
+}
+