Commit aed11452 by Richard Kenner

(build_array_ref): If -Wchar-subscripts, also warn in case when

pointer is being indexed.

From-SVN: r12983
parent 04d23d7c
......@@ -1451,6 +1451,14 @@ build_array_ref (array, index)
tree ar = default_conversion (array);
tree ind = default_conversion (index);
/* Do the same warning check as above, but only on the part that's
syntactically the index and only if it is also semantically
the index. */
if (warn_char_subscripts
&& TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE
&& TYPE_MAIN_VARIANT (TREE_TYPE (index)) == char_type_node)
warning ("subscript has type `char'");
/* Put the integer in IND to simplify error checking. */
if (TREE_CODE (TREE_TYPE (ar)) == INTEGER_TYPE)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment