public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/8816: bad assembly generated
@ 2002-12-04 18:46 tege
  0 siblings, 0 replies; only message in thread
From: tege @ 2002-12-04 18:46 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-05  2:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-04 18:46 target/8816: bad assembly generated tege

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).