aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2014-10-17 18:42:27 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-10-17 18:42:27 +0000
commitf406ae1fd66cbef7528139d813049d606973b4d2 (patch)
treeffce8e64d878ee05289269f4a519e7d104d3fd94 /gcc/c
parent92574c7cdbf3f32fdc48897990d63e1dc65d5bbf (diff)
downloadgcc-f406ae1fd66cbef7528139d813049d606973b4d2.zip
gcc-f406ae1fd66cbef7528139d813049d606973b4d2.tar.gz
gcc-f406ae1fd66cbef7528139d813049d606973b4d2.tar.bz2
re PR c/63549 ([4.8/4.9/5] ICE in build_array_ref with invalid code)
PR c/63549 * c-typeck.c (build_array_ref): Bail if the index in an incomplete type. * gcc.dg/pr63549.c: New test. From-SVN: r216413
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index d6a58a8..bb57ee2 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,11 @@
2014-10-17 Marek Polacek <polacek@redhat.com>
+ PR c/63549
+ * c-typeck.c (build_array_ref): Bail if the index in an incomplete
+ type.
+
+2014-10-17 Marek Polacek <polacek@redhat.com>
+
* c-decl.c (grokdeclarator): Use OPT_Wimplicit_int unconditionally.
(start_function): Use OPT_Wimplicit_int instead of 0.
(store_parm_decls_oldstyle): Likewise.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 5c0697a..1e971c1 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -2478,6 +2478,8 @@ build_array_ref (location_t loc, tree array, tree index)
/* Apply default promotions *after* noticing character types. */
index = default_conversion (index);
+ if (index == error_mark_node)
+ return error_mark_node;
gcc_assert (TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE);