public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/19423] __int128 conversion towards "const __int128 &" should be allowed Date: Wed, 20 Mar 2024 17:25:24 +0000 [thread overview] Message-ID: <bug-19423-4717-3U3OyexcYO@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-19423-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=19423 --- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d391f3721e20d160909a3afae7fee647ea5575a2 commit d391f3721e20d160909a3afae7fee647ea5575a2 Author: Hannes Domani <ssbssa@yahoo.de> Date: Wed Mar 20 18:23:40 2024 +0100 Fix casting in-memory values of primitive types to const reference It's currently not possible to cast an in-memory value of a primitive type to const reference: ``` (gdb) p Q.id $1 = 42 (gdb) p (int&)Q.id $2 = (int &) @0x22fd0c: 42 (gdb) p (const int&)Q.id Attempt to take address of value not located in memory. ``` And if in a function call an argument needs the same kind of casting, it also doesn't work: ``` (gdb) l f3 39 int f3(const int &i) 40 { 41 return i; 42 } (gdb) p f3(Q.id) Attempt to take address of value not located in memory. ``` It's because when the constness of the type changes in a call to value_cast, a new not_lval value is allocated, which doesn't exist in the target memory. Fixed by ignoring const/volatile/restrict qualifications in value_cast when comparing cast type to original type, so the new value will point to the same location as the original value: ``` (gdb) p (int&)i $2 = (int &) @0x39f72c: 1 (gdb) p (const int&)i $3 = (const int &) @0x39f72c: 1 (gdb) p f3(Q.id) $4 = 42 ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19423 Approved-By: Tom Tromey <tom@tromey.com> -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2024-03-20 17:25 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-19423-4717@http.sourceware.org/bugzilla/> 2023-03-01 21:51 ` tromey at sourceware dot org 2023-12-30 16:10 ` ssbssa at sourceware dot org 2024-03-20 17:25 ` cvs-commit at gcc dot gnu.org [this message] 2024-03-20 17:26 ` ssbssa at sourceware dot org
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-19423-4717-3U3OyexcYO@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).