Hi,

when running libgomp.oacc-c-c++-common/parallel-dims.c with -flto -fno-use-linker-plugin, we run into a failing 'test for excess errors'.

The problem is that while -fdiagnostics-color=never is passed to gcc, it's not propagated to lto1, and the error message is annotated with color information, which confuses the test for excess errors.

This patch fixes the problem by making sure that -fdiagnostics-color is propagated to lto1, in the same way that -fdiagnostics-show-caret is propagated to lto1.

Bootstrapped and reg-tested on x86_64.

OK for trunk, stage1?

Thanks,
- Tom
Handle -fdiagnostics-color in lto

2016-02-08  Tom de Vries  <t...@codesourcery.com>

	PR lto/69707
	* common.opt (fdiagnostics-color=): Remove Driver flag.
	* lto-wrapper.c (merge_and_complain, append_compiler_options): Handle
	OPT_fdiagnostics_color_.

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

---
 gcc/common.opt                                        |  2 +-
 gcc/lto-wrapper.c                                     |  2 ++
 .../libgomp.oacc-c-c++-common/parallel-dims-2.c       | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 520fa9c..a740dcb 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1153,7 +1153,7 @@ Common Alias(fdiagnostics-color=,always,never)
 ;
 
 fdiagnostics-color=
-Driver Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_NO)
+Common Joined RejectNegative Var(flag_diagnostics_show_color) Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_NO)
 -fdiagnostics-color=[never|always|auto]	Colorize diagnostics.
 
 ; Required for these enum values.
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index ced6f2f..484dbc1 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -232,6 +232,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
 	    break;
 
 	  /* Fallthru.  */
+	case OPT_fdiagnostics_color_:
 	case OPT_fdiagnostics_show_caret:
 	case OPT_fdiagnostics_show_option:
 	case OPT_fdiagnostics_show_location_:
@@ -497,6 +498,7 @@ append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts,
 	 on any CL_TARGET flag and a few selected others.  */
       switch (option->opt_index)
 	{
+	case OPT_fdiagnostics_color_:
 	case OPT_fdiagnostics_show_caret:
 	case OPT_fdiagnostics_show_option:
 	case OPT_fdiagnostics_show_location_:
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
index 0000000..eea8c7e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims-2.c
@@ -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;
+}
+

Reply via email to