* [PATCH] Fix Cilk+ #pragma cilk grainsize preprocessing (PR c++/69826)
@ 2016-02-17 17:18 Jakub Jelinek
2016-02-19 21:52 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-02-17 17:18 UTC (permalink / raw)
To: Joseph S. Myers, Marek Polacek, Jason Merrill; +Cc: gcc-patches
Hi!
The following testcase works unless -save-temps or ccache is used
(or manually performing -E and compilation separately). The problem
is that #pragma cilk grainsize is supposed to have macro expansion
(except for the grainsize keyword), but we weren't enabling that for -E.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2016-02-17 Jakub Jelinek <jakub@redhat.com>
PR c++/69826
* c-pragma.c (c_pp_lookup_pragma): Handle PRAGMA_CILK_GRAINSIZE.
(init_pragma): Register PRAGMA_CILK_GRAINSIZE even for
flag_preprocess_only.
* c-c++-common/cilk-plus/CK/pr69826-1.c: New test.
* c-c++-common/cilk-plus/CK/pr69826-2.c: New test.
--- gcc/c-family/c-pragma.c.jj 2016-02-01 23:35:05.000000000 +0100
+++ gcc/c-family/c-pragma.c 2016-02-17 14:48:37.489399494 +0100
@@ -1336,6 +1336,13 @@ c_pp_lookup_pragma (unsigned int id, con
return;
}
+ if (id == PRAGMA_CILK_GRAINSIZE)
+ {
+ *space = "cilk";
+ *name = "grainsize";
+ return;
+ }
+
if (id >= PRAGMA_FIRST_EXTERNAL
&& (id < PRAGMA_FIRST_EXTERNAL + registered_pp_pragmas.length ()))
{
@@ -1523,7 +1530,7 @@ init_pragma (void)
cpp_register_deferred_pragma (parse_in, "GCC", "ivdep", PRAGMA_IVDEP, false,
false);
- if (flag_cilkplus && !flag_preprocess_only)
+ if (flag_cilkplus)
cpp_register_deferred_pragma (parse_in, "cilk", "grainsize",
PRAGMA_CILK_GRAINSIZE, true, false);
--- gcc/testsuite/c-c++-common/cilk-plus/CK/pr69826-1.c.jj 2016-02-17 15:09:10.685152534 +0100
+++ gcc/testsuite/c-c++-common/cilk-plus/CK/pr69826-1.c 2016-02-17 15:11:39.518070410 +0100
@@ -0,0 +1,25 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus" } */
+/* { dg-additional-options "-std=gnu99" { target c } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#define GRAINSIZE 2
+
+int
+main ()
+{
+ int a[64];
+ #pragma cilk grainsize=GRAINSIZE
+ _Cilk_for (int i = 0; i < 64; i++)
+ a[i] = 0;
+ #pragma cilk grainsize =GRAINSIZE
+ _Cilk_for (int i = 0; i < 64; i++)
+ a[i]++;
+ #pragma cilk grainsize = GRAINSIZE
+ _Cilk_for (int i = 0; i < 64; i++)
+ a[i]++;
+ for (int i = 0; i < 64; i++)
+ if (a[i] != 2)
+ __builtin_abort ();
+ return 0;
+}
--- gcc/testsuite/c-c++-common/cilk-plus/CK/pr69826-2.c.jj 2016-02-17 15:11:57.073824810 +0100
+++ gcc/testsuite/c-c++-common/cilk-plus/CK/pr69826-2.c 2016-02-17 15:12:12.409610268 +0100
@@ -0,0 +1,6 @@
+/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "-fcilkplus -save-temps" } */
+/* { dg-additional-options "-std=gnu99" { target c } } */
+/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
+
+#include "pr69826-1.c"
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix Cilk+ #pragma cilk grainsize preprocessing (PR c++/69826)
2016-02-17 17:18 [PATCH] Fix Cilk+ #pragma cilk grainsize preprocessing (PR c++/69826) Jakub Jelinek
@ 2016-02-19 21:52 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2016-02-19 21:52 UTC (permalink / raw)
To: Jakub Jelinek, Joseph S. Myers, Marek Polacek, Jason Merrill; +Cc: gcc-patches
On 02/17/2016 10:18 AM, Jakub Jelinek wrote:
> Hi!
>
> The following testcase works unless -save-temps or ccache is used
> (or manually performing -E and compilation separately). The problem
> is that #pragma cilk grainsize is supposed to have macro expansion
> (except for the grainsize keyword), but we weren't enabling that for -E.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2016-02-17 Jakub Jelinek <jakub@redhat.com>
>
> PR c++/69826
> * c-pragma.c (c_pp_lookup_pragma): Handle PRAGMA_CILK_GRAINSIZE.
> (init_pragma): Register PRAGMA_CILK_GRAINSIZE even for
> flag_preprocess_only.
>
> * c-c++-common/cilk-plus/CK/pr69826-1.c: New test.
> * c-c++-common/cilk-plus/CK/pr69826-2.c: New test.
OK.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-19 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 17:18 [PATCH] Fix Cilk+ #pragma cilk grainsize preprocessing (PR c++/69826) Jakub Jelinek
2016-02-19 21:52 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).