public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR 57541
@ 2013-06-07 22:07 Iyer, Balaji V
  0 siblings, 0 replies; only message in thread
From: Iyer, Balaji V @ 2013-06-07 22:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: anna.m.tikhonova

Hello Everyone,
	This patch below should fix the bug reported in PR 57541. The following statements were not caught by the array notation expander, and they should be caught and replaced with zero nodes:

A[:];
A[x:y];
A[x:y:z];

Here are the Changelogs 

gcc/c/ChangeLog
2013-06-07  Balaji V. Iyer  <balaji.v.iyer@intel.com>
        * c-array-notation.c (expand_array_notation_exprs): Added
        ARRAY_NOTATION_REF case.

gcc/testsuite/ChangeLog
2013-06-07  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        PR middle-end/57541
        * c-c++-common/cilk-plus/AN/pr57541.c: New test case.


... and the patch cut and pasted below:

Index: gcc/c/c-array-notation.c
===================================================================
--- gcc/c/c-array-notation.c    (revision 199825)
+++ gcc/c/c-array-notation.c    (working copy)
@@ -2317,6 +2317,14 @@
     case RETURN_EXPR:
       if (contains_array_notation_expr (t))
        t = fix_return_expr (t);
+      return t;
+    case ARRAY_NOTATION_REF:
+      /* IF we are here, then we are dealing with cases like this:
+        A[:];
+        A[x:y:z];
+        A[x:y];
+        Replace those with just void zero node.  */
+      t = void_zero_node;
     default:
       return t;
     }
Index: gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
===================================================================
--- gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c   (revision 0)
+++ gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c   (revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+int A[10];
+
+int main () {
+  char c = (char)N; /* { dg-error "undeclared" } */
+  short s = (short)N;
+  long l = (long)N;
+  A[l:s:c];
+}
+
+/* { dg-message "note: each" "defined" { target *-*-* }  7 } */
+

Since this is a trivial patch, I will commit this in. I am willing to revert it (and/or fix it) if anyone has objections.

Thanks,

Balaji V. Iyer.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-07 22:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-07 22:07 [PATCH] PR 57541 Iyer, Balaji V

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