From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31716 invoked by alias); 1 Feb 2006 10:23:51 -0000 Received: (qmail 31691 invoked by uid 48); 1 Feb 2006 10:23:49 -0000 Date: Wed, 01 Feb 2006 10:23:00 -0000 Message-ID: <20060201102349.31690.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/26060] A ^= B ^= A ^=B doesn't work if compiled with -g In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pluto at agmk dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg00042.txt.bz2 List-Id: ------- Comment #1 from pluto at agmk dot net 2006-02-01 10:23 ------- 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; -- pluto at agmk dot net changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|A ^= B ^= A ^=B doesn't |A ^= B ^= A ^=B doesn't |work if compiled with -g |work if compiled with -g http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26060