This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR 57541
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: "anna dot m dot tikhonova at gmail dot com" <anna dot m dot tikhonova at gmail dot com>
- Date: Fri, 7 Jun 2013 22:07:21 +0000
- Subject: [PATCH] PR 57541
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.