------- Comment #8 from rguenth at gcc dot gnu dot org 2006-10-11 12:30 ------- One minimal fix for this is the following (patches for this I sent many times long time ago, but poking in the C frontend is tedious):
Index: c-typeck.c =================================================================== *** c-typeck.c (revision 117629) --- c-typeck.c (working copy) *************** build_unary_op (enum tree_code code, tre *** 3032,3046 **** } /* For &x[y], return x+y */ ! if (TREE_CODE (arg) == ARRAY_REF) { tree op0 = TREE_OPERAND (arg, 0); if (!c_mark_addressable (op0)) return error_mark_node; ! return build_binary_op (PLUS_EXPR, ! (TREE_CODE (TREE_TYPE (op0)) == ARRAY_TYPE ! ? array_to_pointer_conversion (op0) ! : op0), TREE_OPERAND (arg, 1), 1); } --- 3032,3044 ---- } /* For &x[y], return x+y */ ! if (TREE_CODE (arg) == ARRAY_REF ! && TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) != ARRAY_TYPE) { tree op0 = TREE_OPERAND (arg, 0); if (!c_mark_addressable (op0)) return error_mark_node; ! return build_binary_op (PLUS_EXPR, op0, TREE_OPERAND (arg, 1), 1); } -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu dot | |org, jsm28 at gcc dot gnu | |dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28940