Problem report 5862 for GCC is wrong
Roberto Gordo Saez
rgs@es.alcove.com
Wed Mar 20 06:16:00 GMT 2002
My message is for the bug titled: "GCC generates invalid code in case of a combination of a bitwise AND and an incrementation".
I am sending this to the addresses listed on the web, under the link named "send email to interested parties", because i have no idea of what it is the correct procedure for GNATS.
The problem is with this line:
pdu += (0x7F & *pdu++);
The result of doing that is explained in the standard ISO C as dependant of implementation, and should be avoided on a portable program; so, it is not a bug in GCC.
This text is literal quote from the standard ISO C, section "Assignment operators":
"The order of evaluation of the operands is unspecified. If an attempt is made to modify the result of an assignment operator or to access it after the next sequence point, the behavior is undefined."
In other words, modifying on the right side the variable that is on the left side is undefined, and dependant of the compiler. For example:
i = i++;
Even the same compiler may give different results on other circumstances or future releases.
More information about the Gcc-bugs
mailing list