This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem report 5862 for GCC is wrong
- From: Roberto Gordo Saez <rgs at es dot alcove dot com>
- To: mart at netsoftlund dot se, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org,stefan at netsoftlund dot se, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: Wed, 20 Mar 2002 14:03:34 +0100
- Subject: Problem report 5862 for GCC is wrong
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.