2015-01-22 Tom de Vries <tom@codesourcery.com>
PR libgomp/64707
* lto-opts.c (lto_write_options): Output non-explicit conservative
-fno-openmp.
* lto-wrapper.c (merge_and_complain): Handle merging -fopenmp.
(append_compiler_options): Pass -fopenmp through.
* c.opt (fopenmp): Mark as LTO option.
* lang.opt (fopenmp): Mark as LTO option.
* testsuite/libgomp.c/target-9.c: Add -ftree-parallelize-loops=0 to
dg-options.
---
gcc/c-family/c.opt | 2 +-
gcc/fortran/lang.opt | 2 +-
gcc/lto-opts.c | 4 ++++
gcc/lto-wrapper.c | 2 ++
libgomp/testsuite/libgomp.c/target-9.c | 2 +-
5 files changed, 9 insertions(+), 3 deletions(-)
@@ -1288,7 +1288,7 @@ C ObjC C++ ObjC++ Var(flag_openacc)
Enable OpenACC
fopenmp
-C ObjC C++ ObjC++ Var(flag_openmp)
+C ObjC C++ ObjC++ LTO Var(flag_openmp)
Enable OpenMP (implies -frecursive in Fortran)
fopenmp-simd
@@ -571,7 +571,7 @@ Fortran
; Documented in C
fopenmp
-Fortran
+Fortran LTO
; Documented in C
fopenmp-simd
@@ -166,6 +166,10 @@ lto_write_options (void)
append_to_collect_gcc_options (&temporary_obstack, &first_p,
"-fno-strict-overflow");
+ if (!global_options_set.x_flag_openmp
+ && !global_options.x_flag_openmp)
+ append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fno-openmp");
+
/* Append options from target hook and store them to offload_lto section. */
if (lto_stream_offload_p)
{
@@ -271,6 +271,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
case OPT_fsigned_zeros:
case OPT_ftrapping_math:
case OPT_fwrapv:
+ case OPT_fopenmp:
/* For selected options we can merge conservatively. */
for (j = 0; j < *decoded_options_count; ++j)
if ((*decoded_options)[j].opt_index == foption->opt_index)
@@ -490,6 +491,7 @@ append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts,
case OPT_fsigned_zeros:
case OPT_ftrapping_math:
case OPT_fwrapv:
+ case OPT_fopenmp:
case OPT_ftrapv:
case OPT_fstrict_overflow:
case OPT_foffload_abi_:
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O1" } */
+/* { dg-options "-O1 -ftree-parallelize-loops=0" } */
/* { dg-additional-options "-flto" { target lto } } */
#include <stdlib.h>
--
1.9.1