On Tue, 3 Dec 2013 16:14:49, Eric Botcazou wrote: > >> The patch does add a boolean "expand_reference" parameter to >> expand_expr_real and expand_expr_real_1. I pass true when I intend to use >> the returned memory context as an array reference, instead of a value. At >> places where mis-aligned values are extracted, I do not return a register >> with the extracted mis-aligned value if expand_reference is true. When I >> have a VIEW_CONVERT_EXPR I pay attention to pass down the outer >> "expand_reference" to the inner expand_expr_real call. Expand_reference, is >> pretty much similar to the expand_modifier "EXPAND_MEMORY". > > IMO that's not acceptable as-is, you're papering over the real issue which are > the out-of-bounds accesses in the code, i.e. you essentially have an object > with variable size and non-BLKmode. The patch is too big an hammer for such > an obvious lie to the middle-end. Moreover there is not a _single_ line of > explanation in it. >
OK, I should add some comments. Right. > If we really want to go for a hack instead of fixing the underlying issue, it > should be restricted to the cases where stor-layout.c goes wrong. > To me it does not feel like a hack at all, if the expansion needs to know in what context the result will be used, if it is in an LHS or in a RHS or if the address of the memory is needed. To make that perfectly clear, I just want to help. If you or Richard want to come forward with a better proposal, that's fine. And even if I commit something, it can be reverted anytime, when we have something better. Thanks Bernd > -- > Eric Botcazou