Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2][PR gdb/24789] Allow pointer arithmetic with integer references
Date: Wed, 01 Apr 2020 10:36:43 -0600	[thread overview]
Message-ID: <871rp740ys.fsf@tromey.com> (raw)
In-Reply-To: <20200331220655.4436-1-ssbssa@yahoo.de> (Hannes Domani via Gdb-patches's message of "Wed, 1 Apr 2020 00:06:55 +0200")

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> 2020-04-01  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	PR gdb/24789
Hannes> 	* eval.c (is_integral_or_integral_reference): New function.
Hannes> 	(evaluate_subexp_standard): Allow integer references in
Hannes> 	pointer arithmetic.

Thank you.

Hannes> +/* Return true if type is integral or reference to integral */
Hannes> +
Hannes> +static bool
Hannes> +is_integral_or_integral_reference (struct type *type)
Hannes> +{
Hannes> +  if (is_integral_type (type))
Hannes> +    return true;
Hannes> +
Hannes> +  type = check_typedef (type);
Hannes> +  return type != nullptr
Hannes> +    && TYPE_IS_REFERENCE (type)
Hannes> +    && is_integral_type (TYPE_TARGET_TYPE (type));

This needs parens around the multi-line expression, like:

  return (type != nullptr
	  && TYPE_IS_REFERENCE (type)
	  && is_integral_type (TYPE_TARGET_TYPE (type)));

The patch is ok with this tweak.

Tom


  reply	other threads:[~2020-04-01 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200331220655.4436-1-ssbssa.ref@yahoo.de>
2020-03-31 22:06 ` Hannes Domani
2020-04-01 16:36   ` Tom Tromey [this message]
2020-04-01 17:17     ` Hannes Domani
2020-04-01 17:36       ` Hannes Domani
2020-04-01 18:06         ` Tom Tromey
     [not found]         ` <87sghn2i0g.fsf@tromey.com>
2020-04-01 18:14           ` Hannes Domani
2020-04-01 18:55             ` 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=871rp740ys.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@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: 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