From a0c88d0629a33161add8d5bc083f1e59f3f756f7 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 23 Jan 2015 12:54:16 +0000 Subject: [PATCH] Make fopenacc an LTO option 2015-01-23 Tom de Vries PR libgomp/64672 * lto-opts.c (lto_write_options): Output non-explicit conservative -fno-openacc. * lto-wrapper.c (merge_and_complain): Handle merging -fopenacc. (append_compiler_options): Pass -fopenacc through. * c.opt (fopenacc): Mark as LTO option. * lang.opt (fopenacc): Mark as LTO option. * testsuite/libgomp.oacc-c-c++-common/abort-5.c: New test. From-SVN: r220038 --- gcc/ChangeLog | 8 ++++++++ gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c.opt | 2 +- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/lang.opt | 2 +- gcc/lto-opts.c | 4 ++++ gcc/lto-wrapper.c | 2 ++ libgomp/ChangeLog | 5 +++++ .../libgomp.oacc-c-c++-common/abort-5.c | 18 ++++++++++++++++++ 9 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/abort-5.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 418468faf38..b5beaf62153 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-01-23 Tom de Vries + + PR libgomp/64672 + * lto-opts.c (lto_write_options): Output non-explicit conservative + -fno-openacc. + * lto-wrapper.c (merge_and_complain): Handle merging -fopenacc. + (append_compiler_options): Pass -fopenacc through. + 2015-01-23 Tom de Vries PR libgomp/64707 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index ac72e868157..851e664503f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2015-01-23 Tom de Vries + + PR libgomp/64672 + * c.opt (fopenacc): Mark as LTO option. + 2015-01-23 Tom de Vries PR libgomp/64707 diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 4b92022187f..fd004072515 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1284,7 +1284,7 @@ ObjC ObjC++ Var(flag_objc1_only) Conform to the Objective-C 1.0 language as implemented in GCC 4.0 fopenacc -C ObjC C++ ObjC++ Var(flag_openacc) +C ObjC C++ ObjC++ LTO Var(flag_openacc) Enable OpenACC fopenmp diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5ae81b14a2b..bb663569418 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2015-01-23 Tom de Vries + + PR libgomp/64672 + * lang.opt (fopenacc): Mark as LTO option. + 2015-01-23 Tom de Vries PR libgomp/64707 diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 0360f6c7bad..d86376a917c 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -567,7 +567,7 @@ Fortran Var(flag_module_private) Set default accessibility of module entities to PRIVATE. fopenacc -Fortran +Fortran LTO ; Documented in C fopenmp diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c index d44dba03935..279107fdab3 100644 --- a/gcc/lto-opts.c +++ b/gcc/lto-opts.c @@ -169,6 +169,10 @@ lto_write_options (void) if (!global_options_set.x_flag_openmp && !global_options.x_flag_openmp) append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fno-openmp"); + if (!global_options_set.x_flag_openacc + && !global_options.x_flag_openacc) + append_to_collect_gcc_options (&temporary_obstack, &first_p, + "-fno-openacc"); /* Append options from target hook and store them to offload_lto section. */ if (lto_stream_offload_p) diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 2d0d451af86..e9507717d44 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -272,6 +272,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options, case OPT_ftrapping_math: case OPT_fwrapv: case OPT_fopenmp: + case OPT_fopenacc: /* For selected options we can merge conservatively. */ for (j = 0; j < *decoded_options_count; ++j) if ((*decoded_options)[j].opt_index == foption->opt_index) @@ -492,6 +493,7 @@ append_compiler_options (obstack *argv_obstack, struct cl_decoded_option *opts, case OPT_ftrapping_math: case OPT_fwrapv: case OPT_fopenmp: + case OPT_fopenacc: case OPT_ftrapv: case OPT_fstrict_overflow: case OPT_foffload_abi_: diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 8c722d4e7bb..b6dfa23d3cc 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2015-01-23 Tom de Vries + + PR libgomp/64672 + * testsuite/libgomp.oacc-c-c++-common/abort-5.c: New test. + 2015-01-23 Tom de Vries PR libgomp/64707 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/abort-5.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/abort-5.c new file mode 100644 index 00000000000..314f04a1e76 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/abort-5.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-additional-options "-flto" { target lto } } */ + +#include + +int +main (int argc, char **argv) +{ + +#pragma acc parallel + { + if (argc != 1) + abort (); + } + + return 0; +} + -- 2.30.2