Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-12-18 Thread Jakub Jelinek via Gcc-patches
On Fri, Dec 18, 2020 at 08:15:56PM +, Kwok Cheung Yeung wrote: > On 18/12/2020 7:31 pm, Jakub Jelinek wrote: > > On Fri, Dec 18, 2020 at 03:10:52PM +, Kwok Cheung Yeung wrote: > > > 2020-12-17 Kwok Cheung Yeung > > > > > > gcc/testsuite/ > > > * g++.dg/gomp/declare-target-3.C: New.

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-12-18 Thread Kwok Cheung Yeung
On 18/12/2020 7:31 pm, Jakub Jelinek wrote: On Fri, Dec 18, 2020 at 03:10:52PM +, Kwok Cheung Yeung wrote: 2020-12-17 Kwok Cheung Yeung gcc/testsuite/ * g++.dg/gomp/declare-target-3.C: New. Note the test fails on the trunk when one doesn't have offloading configured. I

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-12-18 Thread Jakub Jelinek via Gcc-patches
On Fri, Dec 18, 2020 at 03:10:52PM +, Kwok Cheung Yeung wrote: > 2020-12-17 Kwok Cheung Yeung > > gcc/testsuite/ > * g++.dg/gomp/declare-target-3.C: New. Note the test fails on the trunk when one doesn't have offloading configured. IL scan tests are always problematic, differe

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-12-18 Thread Jakub Jelinek via Gcc-patches
On Fri, Dec 18, 2020 at 03:10:52PM +, Kwok Cheung Yeung wrote: > --- a/gcc/cp/cp-lang.c > +++ b/gcc/cp/cp-lang.c > @@ -34,6 +34,8 @@ static tree cp_eh_personality (void); > static tree get_template_innermost_arguments_folded (const_tree); > static tree get_template_argument_pack_elems_folded

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-12-18 Thread Kwok Cheung Yeung
On 08/12/2020 4:24 pm, Jakub Jelinek wrote: The GCC coding style (appart from libstdc++) is type * rather than type*, occurs several times in the patch. Fixed. +{ + tree node; + + if (DECL_INITIAL (decl)) +return &DECL_INITIAL (decl); + + for (node = dynamic_initializers; node; node =

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-12-08 Thread Jakub Jelinek via Gcc-patches
On Thu, Nov 19, 2020 at 06:07:28PM +, Kwok Cheung Yeung wrote: > Even without this patch, G++ currently accepts something like Sorry for the delay. > int foo() { return 1; } > int x = foo(); > #pragma omp declare target to(x) > > but will not generate the device-side initializer for x, even

PING Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-11-27 Thread Kwok Cheung Yeung
Hello This patch still needs review. Thanks Kwok On 19/11/2020 6:07 pm, Kwok Cheung Yeung wrote: On 29/10/2020 10:03 am, Jakub Jelinek wrote: I'm actually not sure how this can work correctly. Let's say we have int foo () { return 1; } int bar () { return 2; } int baz () { return 3; } int qu

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-11-19 Thread Kwok Cheung Yeung
On 29/10/2020 10:03 am, Jakub Jelinek wrote: I'm actually not sure how this can work correctly. Let's say we have int foo () { return 1; } int bar () { return 2; } int baz () { return 3; } int qux () { return 4; } int a = foo (); int b = bar (); int c = baz (); int *d = &c; int e = qux (); int f

Re: [PATCH] openmp: Implicit 'declare target' for C++ static initializers

2020-10-29 Thread Jakub Jelinek via Gcc-patches
On Wed, Oct 28, 2020 at 02:20:29PM +, Kwok Cheung Yeung wrote: > OpenMP 5.0 has a new feature for implicitly marking variables and functions > that are referenced in the initializers of static variables and functions > that are already marked 'declare target'. Support was added in the commit >