This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Add ability to have ARRAY_REF on pointers


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]