This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/875: Code generation error on UltraSPARC ( Ultra 5 )
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/875: Code generation error on UltraSPARC ( Ultra 5 )
- From: davide_libenzi at mycio dot com
- Date: 23 Nov 2000 21:17:07 -0000
- Reply-To: davide_libenzi at mycio dot com
>Number: 875
>Category: c
>Synopsis: Code generation error on UltraSPARC ( Ultra 5 )
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 23 13:26:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Davide Libenzi
>Release: unknown-1.0
>Organization:
>Environment:
Sun UltraSPARC ( Ultra 5 )
gcc 2.95.2
binutils 2.9.1
>Description:
The number of bytes to copy, calling memcpy(), is after the call to such function.
>How-To-Repeat:
See attachment.
>Fix:
Remove inlined functions.
>Release-Note:
>Audit-Trail:
>Unformatted:
>>> 0x105d8 <test_proc__Fi+108>: call 0x207a0 <memcpy>
>>> 0x105dc <test_proc__Fi+112>: mov 2, %o2
0x105e0 <test_proc__Fi+116>: b,a 0x1061c <test_proc__Fi+176>
0x105e4 <test_proc__Fi+120>: call 0x10560 <verb__Fv>
0x105e8 <test_proc__Fi+124>: clr %i0
0x105ec <test_proc__Fi+128>: call 0x10560 <verb__Fv>
0x105f0 <test_proc__Fi+132>: nop
0x105f4 <test_proc__Fi+136>: add %o0, 4, %o1
0x105f8 <test_proc__Fi+140>: mov 2, %o2
0x105fc <test_proc__Fi+144>: call 0x207a0 <memcpy>
0x10600 <test_proc__Fi+148>: add %fp, -22, %o0
0x10604 <test_proc__Fi+152>: call 0x10560 <verb__Fv>
0x10608 <test_proc__Fi+156>: nop
0x1060c <test_proc__Fi+160>: add %o0, 6, %o1
0x10610 <test_proc__Fi+164>: add %fp, -24, %o0
>>> 0x10614 <test_proc__Fi+168>: call 0x207a0 <memcpy>
>>> 0x10618 <test_proc__Fi+172>: mov 2, %o2
0x1061c <test_proc__Fi+176>: ret
0x10620 <test_proc__Fi+180>: restore
End of assembler dump.
----gnatsweb-attachment----
Content-Type: text/plain; name="bug.txt"
Content-Disposition: inline; filename="bug.txt"
#include <unistd.h>
#include <stdio.h>
#include <string.h>
typedef unsigned short WORD;
inline WORD SwapWord(WORD x)
{
return (WORD)(((x&0x00ff)<<8) | ((x&0xff00)>>8));
}
inline WORD WordPtr_Fun(const void *x)
{
WORD temp;
return SwapWord(*(WORD *)memcpy(&temp,x,2));
}
#define WORDPTR( x ) WordPtr_Fun(&(x))
char * kkk = "hsoahds1212dsoakdbk";
char *verb()
{
return (kkk);
}
int
test_proc(int ival)
{
WORD topbit, start, end;
WORD j, d, okcrc;
if (ival)
{
j = (WORD) ((verb()[1] - verb()[2]) / 4 - 1);
d = (WORD) (verb()[2] + 1);
okcrc = WORDPTR(verb()[d + 2]);
end = WORDPTR(verb()[d + 4]);
d += 6;
}
else
{
j = (WORD) ((verb()[1] - 6) / 4);
okcrc = WORDPTR(verb()[4]);
end = WORDPTR(verb()[6]);
d = 8;
}
return (0);
}
int
main(int argc, char * argv[])
{
test_proc(1);
return (0);
}
# gcc -v -save-temps -o bug -O2 -g bug.cpp
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix
-Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__OPTIMIZE__ -g -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) bug.cpp bug.ii
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../include/g++-3
/usr/local/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../sparc-sun-solaris2.7/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/cc1plus bug.ii -quiet -dumpbase bug.cc -g -O2 -version -o bug.s
GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.7) compiled by GNU C version 2.95.2 19991024 (release).
/usr/local/sparc-sun-solaris2.7/bin/as -V -Qy -s -o bug.o bug.s
GNU assembler version 2.9.1 (sparc-sun-solaris2.7), using BFD version 2.9.1
/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o bug /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crt1.o /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crti.o /usr/ccs/lib/values-Xa.o /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crtbegin.o -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2 -L/usr/local/sparc-sun-solaris2.7/lib -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/lib bug.o -lgcc -lc -lgcc /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crtend.o /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/crtn.o
GNU ld version 2.9.1 (with BFD 2.9.1)
Supported emulations:
elf32_sparc
Dump of assembler code for function test_proc__Fi:
0x1056c <test_proc__Fi>: save %sp, -120, %sp
0x10570 <test_proc__Fi+4>: cmp %i0, 0
0x10574 <test_proc__Fi+8>: be 0x105e4 <test_proc__Fi+120>
0x10578 <test_proc__Fi+12>: nop
0x1057c <test_proc__Fi+16>: call 0x10560 <verb__Fv>
0x10580 <test_proc__Fi+20>: clr %i0 ! 0x0
0x10584 <test_proc__Fi+24>: call 0x10560 <verb__Fv>
0x10588 <test_proc__Fi+28>: nop
0x1058c <test_proc__Fi+32>: call 0x10560 <verb__Fv>
0x10590 <test_proc__Fi+36>: nop
0x10594 <test_proc__Fi+40>: ldub [ %o0 + 2 ], %l0
0x10598 <test_proc__Fi+44>: sll %l0, 0x18, %l0
0x1059c <test_proc__Fi+48>: sra %l0, 0x18, %l0
0x105a0 <test_proc__Fi+52>: call 0x10560 <verb__Fv>
0x105a4 <test_proc__Fi+56>: inc %l0
0x105a8 <test_proc__Fi+60>: sll %l0, 0x10, %l0
0x105ac <test_proc__Fi+64>: srl %l0, 0x10, %l0
0x105b0 <test_proc__Fi+68>: add %l0, %o0, %o0
0x105b4 <test_proc__Fi+72>: add %o0, 2, %o1
0x105b8 <test_proc__Fi+76>: mov 2, %o2
0x105bc <test_proc__Fi+80>: call 0x207a0 <memcpy>
0x105c0 <test_proc__Fi+84>: add %fp, -18, %o0
0x105c4 <test_proc__Fi+88>: call 0x10560 <verb__Fv>
0x105c8 <test_proc__Fi+92>: nop
0x105cc <test_proc__Fi+96>: add %l0, %o0, %l0
0x105d0 <test_proc__Fi+100>: add %l0, 4, %o1
0x105d4 <test_proc__Fi+104>: add %fp, -20, %o0