It is gcc 4.1.0, --target=arm-elf compiled on an Intel platform and
GNU/Linux.

The following construct:

void *p;

        ((char *)p)++;

makes the compiler to issue an error message, namely
"invalid lvalue in increment"

The ((char *)p) construct is perfectly valid object, a char pointer which
can be lvalue and rvalue alike. For some reason gcc 4.1.0 (and 4.0.2 as
well) treats ((SOME_TYPE *)p) as if it could not be an lvalue; older
versions treat the expression (as expected) as if p was a pointer to
SOME_TYPE instead of to void. This is true even if -std=c89 is specified,
and according to the old ANSI standard the above construct most definitely
is a valid lvalue.

Best Regards,

Zoltan




Reply via email to