Bug 8816 - [Sparc] bad assembly generated
Summary: [Sparc] bad assembly generated
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.2.1
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2002-12-04 18:46 UTC by tege
Modified: 2003-06-16 20:35 UTC (History)
2 users (show)

See Also:
Host: sparc-sun-solaris2.7
Target: sparc-sun-solaris2.7
Build: sparc-sun-solaris2.7
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tege 2002-12-04 18:46:02 UTC
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.

Release:
3.2.1

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

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;
}
Comment 1 Eric Botcazou 2003-03-17 11:33:14 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: I can't reproduce the problem with the same configuration as
    yours. I have
    
       lduh    [%o0+2], %o0
    
    in the assembly file.
Comment 2 Dara Hazeghi 2003-06-16 20:15:48 UTC
Eric, this report has been awaiting feedback for 3 months. Should it be closed? 
Thanks,

Dara
Comment 3 Eric Botcazou 2003-06-16 20:35:44 UTC
No feedback for three months.