public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: PR28977 tc-i386.c internal error in parse_register
Date: Fri, 18 Mar 2022 08:12:46 +0100	[thread overview]
Message-ID: <2da05d25-9304-bb71-1fee-9370a0171331@suse.com> (raw)
In-Reply-To: <YjQtLXZ5Xx5y6lkS@squeak.grove.modra.org>

On 18.03.2022 07:56, Alan Modra via Binutils wrote:
> 	PR 28977
> 	* config/tc-i386.c (parse_register): Handle X_op not O_register
> 	as for a non-reg_section symbol.  Simplify array bounds check.

Hmm, isn't it that ...

> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -12952,17 +12952,18 @@ parse_register (char *reg_string, char **end_op)
>  	{

... the if() right outside of context here is pointing at the actual
problem? Why would "s=%rdx % %rcx" result in a reg_section expression?
Imo this clearly ought to be expr_section.

Jan

>  	  const expressionS *e = symbol_get_value_expression (symbolP);
>  
> -	  know (e->X_op == O_register);
> -	  know (e->X_add_number >= 0
> -		&& (valueT) e->X_add_number < i386_regtab_size);
> -	  r = i386_regtab + e->X_add_number;
> -	  if (!check_register (r))
> +	  if (e->X_op == O_register
> +	      && (valueT) e->X_add_number < i386_regtab_size)
>  	    {
> -	      as_bad (_("register '%s%s' cannot be used here"),
> -		      register_prefix, r->reg_name);
> -	      r = &bad_reg;
> +	      r = i386_regtab + e->X_add_number;
> +	      if (!check_register (r))
> +		{
> +		  as_bad (_("register '%s%s' cannot be used here"),
> +			  register_prefix, r->reg_name);
> +		  r = &bad_reg;
> +		}
> +	      *end_op = input_line_pointer;
>  	    }
> -	  *end_op = input_line_pointer;
>  	}
>        *input_line_pointer = c;
>        input_line_pointer = save;
> 


  reply	other threads:[~2022-03-18  7:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18  6:56 Alan Modra
2022-03-18  7:12 ` Jan Beulich [this message]
2022-03-18  7:32   ` Alan Modra
2022-03-18  9:39     ` Jan Beulich
2022-03-18 12:03       ` Alan Modra
2022-03-21 16:59         ` Jan Beulich

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=2da05d25-9304-bb71-1fee-9370a0171331@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.com \
    --cc=binutils@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).