public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "bpeeluk at yahoo dot co.uk" <sourceware-bugzilla@sourceware.org> 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 [thread overview] Message-ID: <bug-29859-4717-CzuD6TTXKo@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-29859-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=29859 --- Comment #4 from Neil Roberts <bpeeluk at yahoo dot co.uk> --- Thanks for the very quick response. This is just nitpicking and I guess it doesn’t really matter, but I’d 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 operators 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 = $b = 3 $1 = () This was being interpreted as $a = ($b = 3). The value of an assignment expression is () (unlike in C), so $a becomes (). After the patch it gives an error: (gdb) p $a = $b = 3 Left operand of assignment is not an lvalue. That’s presumably because it’s being interpreted as “($a = $b) = 3” and “$a = $b” isn’t an lvalue. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2022-12-06 15:37 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-06 12:33 [Bug rust/29859] New: " bpeeluk at yahoo dot co.uk 2022-12-06 14:14 ` [Bug rust/29859] " tromey at sourceware dot org 2022-12-06 14:43 ` cvs-commit at gcc dot gnu.org 2022-12-06 14:43 ` tromey at sourceware dot org 2022-12-06 15:37 ` bpeeluk at yahoo dot co.uk [this message] 2022-12-06 22:14 ` tromey at sourceware dot org 2022-12-12 13:44 ` cvs-commit at gcc dot gnu.org 2022-12-12 13:46 ` tromey at sourceware dot org 2022-12-13 13:01 ` bpeeluk at yahoo dot co.uk
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29859-4717-CzuD6TTXKo@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).