From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C8AE73846989; Tue, 6 Dec 2022 15:37:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8AE73846989 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670341066; bh=N+6tXVKsVT1tEjeM4W659N+wsZPKzGyH/gU6lLwBvF4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RyvDCaF03fKrz5+39WRn0hxh1Mb3JJfY7phd7X8XW/lgoIv02wF1OdmVQzwblrK9e qeoEMIdZaClml5P4I34mh3JBvExaVskpQo3HdEKyPnewJM4EVXJ0l980wfou5BuSAb 3H4rYdWyvHcbknbA7EL5sGJa1M0bkf8kNv56zogU= From: "bpeeluk at yahoo dot co.uk" To: gdb-prs@sourceware.org Subject: [Bug rust/29859] Printing rust expressions with simple arithmetic gets wrong result Date: Tue, 06 Dec 2022 15:37:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: rust X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bpeeluk at yahoo dot co.uk X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tromey at sourceware dot org X-Bugzilla-Target-Milestone: 13.1 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29859 --- Comment #4 from Neil Roberts --- Thanks for the very quick response. This is just nitpicking and I guess it doesn=E2=80=99t really matter, but I= =E2=80=99d like to point out that this commit has effectively changed all operators to be left-to-right associative whereas previously they were all right-to-left associative. This is clearly an improvement because almost all of the opera= tors are supposed to be left-to-right. However, the assignment operators really = are supposed to be right-to-left as you can see in the Rust docs: https://doc.rust-lang.org/reference/expressions.html#expression-precedence So now we have a regression where previously we had this correct behaviour: (gdb) p $a =3D $b =3D 3 $1 =3D () This was being interpreted as $a =3D ($b =3D 3). The value of an assignment expression is () (unlike in C), so $a becomes (). After the patch it gives an error: (gdb) p $a =3D $b =3D 3 Left operand of assignment is not an lvalue. That=E2=80=99s presumably because it=E2=80=99s being interpreted as =E2=80= =9C($a =3D $b) =3D 3=E2=80=9D and =E2=80=9C$a =3D $b=E2=80=9D isn=E2=80=99t an lvalue. --=20 You are receiving this mail because: You are on the CC list for the bug.=