I'm getting a "operation on xxx may be undefined" error in GCC 4.5.1 that I didn't use to get in 4.3.4
Ian Lance Taylor
iant@google.com
Fri Apr 29 19:38:00 GMT 2011
Staffan Tjernstrom <stjernstrom@acm.org> writes:
>>The PHYSICAL_ADDR macro uses its argument twice. You are passing an
>>assignment statement to PHYSICAL_ADDR. The effect is that you are
>>assigning to p_parent twice in a single expression. In C/C++ assigning
>>to the same variable more than once in a single expression is undefined
>>behaviour. This warning is controlled by -Wsequence-point, q.v.
>
> Thanks, that clarifies the scenario (although in this case the RHS of the multiple assign is the same in both cases AFAICT ...)
To be clear, the fact that the RHS is the same is irrelevant. C/C++
says that assigning to the same LHS twice in a single expression is
undefined, regardless of what the LHS is being set to.
Ian
More information about the Gcc-help
mailing list