Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/exp] Fix assert when adding ptr to imaginary unit
Date: Thu, 28 Jan 2021 07:08:50 -0700	[thread overview]
Message-ID: <87im7hduh9.fsf@tromey.com> (raw)
In-Reply-To: <20210128130655.GA8529@delia> (Tom de Vries's message of "Thu, 28 Jan 2021 14:06:56 +0100")

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> 2021-01-28  Tom de Vries  <tdevries@suse.de>

Tom> 	PR exp/27265
Tom> 	* valarith.c (scalar_binop): Don't call complex_binop unless
Tom> 	arguments are either complex or can be casted to complex.

Thanks for doing this.

Tom> +  if ((type1->code () == TYPE_CODE_COMPLEX
Tom> +       && (type2->code () == TYPE_CODE_COMPLEX
Tom> +	   || type2->code () == TYPE_CODE_INT
Tom> +	   || type2->code () == TYPE_CODE_FLT))
Tom> +      || ((type2->code () == TYPE_CODE_COMPLEX
Tom> +	   && (type1->code () == TYPE_CODE_COMPLEX
Tom> +	       || type1->code () == TYPE_CODE_INT
Tom> +	       || type1->code () == TYPE_CODE_FLT))))
Tom>      return complex_binop (arg1, arg2, op);

Maybe it should use is_floating_type || is_integral_type instead?
is_scalar_type sounds like it should be right but does something really
different instead.  That function looks suspect to me.

This approach would still rule out fixed point.  I'm not sure if that's
ok to do though.

Also weirdly, is_fixed_point_type looks through TYPE_CODE_RANGE (seems
reasonable) but is_integral_type does not (seems wrong).

thanks,
Tom

  reply	other threads:[~2021-01-28 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 13:06 Tom de Vries
2021-01-28 14:08 ` Tom Tromey [this message]
2021-01-29  7:04   ` Tom de Vries
2021-01-29  7:10     ` Tom de Vries
2021-02-05 10:05       ` Tom de Vries
2021-02-05  9:57     ` 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=87im7hduh9.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --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