public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: tege@bob.swox.se
To: gcc-gnats@gcc.gnu.org
Subject: target/8816: bad assembly generated
Date: Wed, 04 Dec 2002 18:46:00 -0000	[thread overview]
Message-ID: <20021205024245.2F7ED7@bob.swox.se> (raw)


>Number:         8816
>Category:       target
>Synopsis:       bad assembly generated
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 04 18:46:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Torbjorn Granlund
>Release:        3.2.1
>Organization:
Swox AB
>Environment:
System: SunOS bob.swox.se 5.7 Generic sun4u sparc SUNW,Ultra-60
Architecture: sun4

	
host: sparc-sun-solaris2.7
build: sparc-sun-solaris2.7
target: sparc-sun-solaris2.7
configured with: /u/gcc/gcc-3.2.1/configure --enable-languages=c,c++
>Description:
Incorrect assembly code is generated for symbol+constant expressions
that are generated as a result of constant propagation.
Assembly sample:

        lduh    [%o0+%lo(tab)+2], %o0

The last instruction is really dubious, adding a cnstant outside the
lo() expression.  The system assembler rightly complains, but the GNU
assembler (version 2.13.1) silently ignores the +2.  (I report that
bug separately.)

What makes this bug really serious is that the GNU assembler misses
the incorrect assembly syntax.

>How-To-Repeat:
Compilation command: gcc -O -m64 ~/tco.c

This is tco.c:
unsigned short tab[] = {  0xbad, 0xcafe };
int
foo ()
{
  int n = 1;
  return tab[n];
}
int
main ()
{
  if (foo () != 0xcafe)
    abort ();
  return 0;
}

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2002-12-05  2:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021205024245.2F7ED7@bob.swox.se \
    --to=tege@bob.swox.se \
    --cc=gcc-gnats@gcc.gnu.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).