On Fri, Nov 19, 2004 at 04:40:35PM -0800, Ziemowit Laski wrote:
As I've alluded to in an earlier e-mail, bringing back the entire
cast-as-lvalue
functionality is probably not necessary (and yes, it can interact
rather badly
with C and C++, as I have finally been convinced). However, I did
make
a
suggestion that we could create a special flag (e.g.,
'-fassign-to-cast' or
some such) that would allow an assignment (including ++ and --) to a
cast.
The cast would have to be treated as a non-lvalue for the purposes of
C++ overloading. For cases where the cast is dereferenced, there are
issues with aliasing; -fno-strict-alias might have to be used to keep
the compiler from generating bad code (this doesn't affect the pointer
increment case, only if a value is written through a cast).
And then there's the problem of representing cast-as-lvalue in GIMPLE;
I'm not competent to advise you there. The case where
((type*)voidp)++;
is used because you want to add
sizeof(type) to a void pointer could just be turned into
type* tmp = voidp;
++tmp;
voidp = tmp;
by the front end, but I have no clue about how to handle the general
case, partly because I'm not even sure what the semantics are.