From: "Iyer, Balaji V" <balaji.v.iyer@intel.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "anna.m.tikhonova@gmail.com" <anna.m.tikhonova@gmail.com>
Subject: [PATCH] PR 57541
Date: Fri, 07 Jun 2013 22:07:00 -0000 [thread overview]
Message-ID: <BF230D13CA30DD48930C31D4099330003A42C054@FMSMSX101.amr.corp.intel.com> (raw)
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.
reply other threads:[~2013-06-07 22:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BF230D13CA30DD48930C31D4099330003A42C054@FMSMSX101.amr.corp.intel.com \
--to=balaji.v.iyer@intel.com \
--cc=anna.m.tikhonova@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).