This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

target/8816: bad assembly generated


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]