From: Pedro Alves <pedro@palves.net>
To: Tom Tromey <tom@tromey.com>, Kevin Buettner <kevinb@redhat.com>
Cc: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/exp] Fix cast handling for indirection
Date: Fri, 3 May 2024 17:04:41 +0100 [thread overview]
Message-ID: <51de396e-67fc-4451-a13e-091178d188f7@palves.net> (raw)
In-Reply-To: <8734qyex0l.fsf@tromey.com>
On 2024-05-03 16:27, Tom Tromey wrote:
> Here the function actually returns char*, it's just the debug info is
> missing.
>
> Normally users should have written:
>
> print *(char *) a_loc()
>
> here, at least after the changes a while ago to require a cast of the
> return type here. Longer ago, debuginfo-less functions did default to
> int return in gdb, but Pedro (I think) changed this a while back.
Yes.
>
> I was wondering if this patch causes gdb to accept some weird things
> that might have been rejected in the past, by introducing a hidden cast.
> Maybe print (char) *85732 does something surprising now. I'm not
> entirely sure if that's bad.
I am totally surprised that:
+# Regression test for PR31693.
+gdb_test "p (char)*a_loc ()" " = 97 'a'"
this actually works, instead of telling the user:
"'a_loc' has unknown return type; cast the call to its declared return type"
It seems like a misfeature to me to assume that "char *" is the right type.
Thus, I don't agree with the patch.
next prev parent reply other threads:[~2024-05-03 16:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 15:49 Tom de Vries
2024-05-03 2:31 ` Kevin Buettner
2024-05-03 7:37 ` Tom de Vries
2024-05-03 15:27 ` Tom Tromey
2024-05-03 16:04 ` Pedro Alves [this message]
2024-05-03 17:30 ` Kevin Buettner
2024-05-03 23:17 ` Pedro Alves
2024-05-03 23:26 ` Pedro Alves
2024-05-06 0:54 ` Kevin Buettner
2024-05-06 6:52 ` Tom de Vries
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=51de396e-67fc-4451-a13e-091178d188f7@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
--cc=tdevries@suse.de \
--cc=tom@tromey.com \
/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).