public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][Cilkplus] Local Label inside Cilk_for fix
@ 2011-09-08  6:41 Iyer, Balaji V
  2011-09-08 14:09 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Iyer, Balaji V @ 2011-09-08  6:41 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

Hello Everyone,
               Local label inside a _Cilk_for was giving an error in the C++ Compiler of Cilk Plus GCC branch. This patch should fix that.

Thanks,

Balaji V. Iyer.

[-- Attachment #2: label_patch --]
[-- Type: application/octet-stream, Size: 2448 bytes --]

diff --git a/gcc/cp/ChangeLog.cilk b/gcc/cp/ChangeLog.cilk
index 861e2e3..b49f3bf 100644
--- a/gcc/cp/ChangeLog.cilk
+++ b/gcc/cp/ChangeLog.cilk
@@ -1,3 +1,8 @@
+2011-09-07  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* parser.c (cp_parser_jump_statement): Removed "IN_CILK_FOR | " from
+	  if (parser->in_statement & (IN_CILK_FOR | IN_CILK_SPAWN)).
+
 2011-08-08  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	* call.c: Added #include "cilk.h"
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c3796c3..066d04d 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9422,7 +9422,7 @@ cp_parser_jump_statement (cp_parser* parser)
 	  /* Labels declared outside a Cilk block are not usable
 	     inside a Cilk block.  Labels declared inside a Cilk
 	     block are local to the Cilk block. */
-	  if (parser->in_statement & (IN_CILK_FOR | IN_CILK_SPAWN))
+	  if (parser->in_statement & IN_CILK_SPAWN)
 	    dest = cilk_block_local_label (dest);
 	  finish_goto_stmt (dest);
 	}
diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk
index b23bff4..7805a29 100644
--- a/gcc/testsuite/ChangeLog.cilk
+++ b/gcc/testsuite/ChangeLog.cilk
@@ -1,3 +1,8 @@
+2011-09-08  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	* gcc.dg/cilk-plus/label_test.c: New.
+	* g++.dg/cilk-plus/label_test.cpp: New.
+
 2011-09-07  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	* gcc.dg/cilk-plus/test__cilk.c: New.
diff --git a/gcc/testsuite/g++.dg/cilk-plus/label_test.cpp b/gcc/testsuite/g++.dg/cilk-plus/label_test.cpp
new file mode 100755
index 0000000..97f0631
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cilk-plus/label_test.cpp
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int main(void)
+{
+  int jj = 0;
+
+  _Cilk_for (int ii = 0; ii < 10; ii++)
+    {
+      if ((ii % 2) == 0)
+	goto hello_label;
+      else
+	goto world_label;
+
+hello_label:
+      printf("Hello ");
+world_label:
+      printf("World\n");
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/cilk-plus/label_test.c b/gcc/testsuite/gcc.dg/cilk-plus/label_test.c
new file mode 100644
index 0000000..97f0631
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cilk-plus/label_test.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int main(void)
+{
+  int jj = 0;
+
+  _Cilk_for (int ii = 0; ii < 10; ii++)
+    {
+      if ((ii % 2) == 0)
+	goto hello_label;
+      else
+	goto world_label;
+
+hello_label:
+      printf("Hello ");
+world_label:
+      printf("World\n");
+    }
+  return 0;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][Cilkplus] Local Label inside Cilk_for fix
  2011-09-08  6:41 [PATCH][Cilkplus] Local Label inside Cilk_for fix Iyer, Balaji V
@ 2011-09-08 14:09 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2011-09-08 14:09 UTC (permalink / raw)
  To: Iyer, Balaji V; +Cc: gcc-patches

On Wed, Sep 7, 2011 at 8:30 PM, Iyer, Balaji V <balaji.v.iyer@intel.com> wrote:
> Hello Everyone,
>                Local label inside a _Cilk_for was giving an error in the C++ Compiler of Cilk Plus GCC branch. This patch should fix that.
>
> Thanks,

I checked it in for you.

-- 
H.J.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-08 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08  6:41 [PATCH][Cilkplus] Local Label inside Cilk_for fix Iyer, Balaji V
2011-09-08 14:09 ` H.J. Lu

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).