public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@armltd.co.uk>
To: raeburn@cygnus.com
Cc: gas2@cygnus.com
Subject: Inconsistent behaviour (in resolve_symbol_value?)
Date: Mon, 05 Aug 1996 09:31:00 -0000	[thread overview]
Message-ID: <9608051502.AA02481@sun52.armltd> (raw)

The following ARM assembler file should generate errors for both lines, but
only generates an error for the second:

foo.s:
        mov     r0, #1 | bar
        mov     r1, # bar | 1
as.new foo.s
foo.s: Assembler messages:
foo.s:2: Error: L0 set to illegal operation on non-absolute symbols

The problem seems to be the code in resolve_symbol_value that handles
various binary operations.  I'm not sure what the code is trying to check
for so I'm not sure what the fix should be.  Both 'if' clauses involve
checks for undefined sections, but the cases are very specific.  Further,
after the logical operation has been performed the type of the node is
changed to O_constant, so it is no-longer possible to recover the
operation in the back end.

	...
        case O_bit_inclusive_or:
	...
        case O_logical_or:
          resolve_symbol_value (symp->sy_value.X_add_symbol);
          resolve_symbol_value (symp->sy_value.X_op_symbol);
          seg_left = S_GET_SEGMENT (symp->sy_value.X_add_symbol);
          seg_right = S_GET_SEGMENT (symp->sy_value.X_op_symbol);
          if (seg_left != seg_right
              && seg_left != undefined_section
              && seg_right != undefined_section)
            {
              char *file;
              unsigned int line;

              if (expr_symbol_where (symp, &file, &line))
                as_bad_where
                  (file, line,
                   "illegal operation on symbols in different sections");
              else
                as_bad
                  ("%s set to illegal operation on symbols in different section
                   S_GET_NAME (symp));
            }
          if ((S_GET_SEGMENT (symp->sy_value.X_add_symbol)
               != absolute_section)
              && symp->sy_value.X_op != O_subtract)
            {
              char *file;
              unsigned int line;

              if (expr_symbol_where (symp, &file, &line))
                as_bad_where (file, line,
                              "illegal operation on non-absolute symbols");
              else
                as_bad ("%s set to illegal operation on non-absolute symbols",
                        S_GET_NAME (symp));
            }
          left = S_GET_VALUE (symp->sy_value.X_add_symbol);
          right = S_GET_VALUE (symp->sy_value.X_op_symbol);
 	  ...

This is a serious problem for a user, since it quietly generating code that
is incorrect.





             reply	other threads:[~1996-08-05  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-05  9:31 Richard Earnshaw [this message]
1996-08-07 12:34 ` Ian Lance Taylor

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=9608051502.AA02481@sun52.armltd \
    --to=rearnsha@armltd.co.uk \
    --cc=gas2@cygnus.com \
    --cc=raeburn@cygnus.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).