From: Tom Tromey <tom@tromey.com>
To: Hannes Domani <ssbssa@yahoo.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix casting in-memory values of primitive types to const reference
Date: Wed, 20 Mar 2024 11:05:45 -0600 [thread overview]
Message-ID: <87msqsg7fa.fsf@tromey.com> (raw)
In-Reply-To: <20240320160844.106-1-ssbssa@yahoo.de> (Hannes Domani's message of "Wed, 20 Mar 2024 17:08:44 +0100")
>>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes:
Hannes> It's currently not possible to cast an in-memory value of a primitive
Hannes> type to const reference:
Thank you for the patch.
I think it is ok. However I suspect there may be other bugs here.
Approved-By: Tom Tromey <tom@tromey.com>
Hannes> Fixed by ignoring const/volatile/restrict qualifications in
Hannes> value_cast when comparing cast type to original type, so the new
Hannes> value will point to the same location as the original value:
Hannes> - if (types_deeply_equal (arg2->type (), type))
Hannes> + if (types_deeply_equal (make_unqualified_type (arg2->type ()),
Hannes> + make_unqualified_type (type)))
This code seems slightly weird in that it isn't calling check_typedef.
So, I wonder what happens if typedefs are involved, for example if you
did:
typedef const int ci;
(gdb) print (ci&) Q.id
thanks,
Tom
next prev parent reply other threads:[~2024-03-20 17:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240320160844.106-1-ssbssa.ref@yahoo.de>
2024-03-20 16:08 ` Hannes Domani
2024-03-20 17:05 ` Tom Tromey [this message]
2024-03-20 17:25 ` Hannes Domani
2024-03-20 17:33 ` Tom Tromey
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=87msqsg7fa.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=ssbssa@yahoo.de \
/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: link
Be 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).