Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: 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, 03 May 2024 09:27:22 -0600	[thread overview]
Message-ID: <8734qyex0l.fsf@tromey.com> (raw)
In-Reply-To: <20240502193145.5da7327d@f39-zbm-amd> (Kevin Buettner's message of "Thu, 2 May 2024 19:31:45 -0700")

>>>>> "Kevin" == Kevin Buettner <kevinb@redhat.com> writes:

>> char *
>> a_loc (void)

Kevin> This surprised me.  I would have thought that the evaluation would
Kevin> have been:

Kevin>     (char)*(int)a_loc ()

Kevin> ...due to the fact that functions lacking an explicit return type
Kevin> return 'int' in traditional C.

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.

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.

Tom

  parent reply	other threads:[~2024-05-03 15:27 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 [this message]
2024-05-03 16:04     ` Pedro Alves
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=8734qyex0l.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --cc=tdevries@suse.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