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]

[Bug c/26923] byte swap incorrect



------- Comment #1 from pluto at agmk dot net  2006-03-29 18:51 -------
It's not a gcc bug. The code relies on the results of intermediate
subexpressions.  According to Stroustrup, The C++ Programming Language, section
6.2.2, "The order of evaluation of subexpressions within
an expression is undefined."

You should use sequence points e.g.:

        a ^= b, b ^= a, a ^= b;

This is a dup of PR11751


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26923


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