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] no lowering of &a.b (and &a->b) in the C front-end


On Sun, 22 Aug 2004, Andrew Pinski wrote:

> I found that both the C and C++ front-ends do lower &a.b into a +
> offsetof(b,a)
> which is really not good for some optimizations which can change the struct
> a into scaler values.

Anything susceptible to a testcase (i.e. one failing before this patch and 
passing afterwards)?

> @@ -2538,9 +2538,14 @@ build_unary_op (enum tree_code code, tre
>  	    addr = fold (build2 (PLUS_EXPR, argtype,
>  				 convert (argtype, addr),
>  				 convert (argtype, byte_position (field))));
> +	+	    addr2 = build1 (ADDR_EXPR, argtype, arg);
> +	+	    if (!TREE_CONSTANT (addr) || TREE_CONSTANT (addr2))

There looks to be something odd about this "+     +" in the patch.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal 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]