This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]