This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Add ability to have ARRAY_REF on pointers
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 28 Jun 2005 10:31:24 +0000 (UTC)
- Subject: Re: [PATCH]: Add ability to have ARRAY_REF on pointers
- References: <1119917241.8059.36.camel@dyn9002219137>
The use of TYPE_MAIN_VARIANT in c-typeck.c:build_array_ref
> + type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (ar)));
seems wrong as it removes type qualifiers, including on elements of
arrays. For example,
const int (*p)[2][2];
void f(void) { **(p[0]) = 0; }
is diagnosed before the patch but not afterwards. Even on non-arrays,
preserving the type qualifiers means we get typeof correct.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)