egcs-980115, solaris-2.4, bus error with builtin memset
Chris Johns
cjohns@plessey.com.au
Sun Jan 25 03:03:00 GMT 1998
hi
Testing an RTEMS snapshot on the solaris target with egcs-980115, the
posix unix specific cpu module generates a bus error during
initialisation. The small test program following generates the problem.
When using -fno-builtin, no bus error is generated.
I do not know the sparc instruction set or gcc internals so cannot
provide much help.
Regards
**************** cpu.c *************
#include <setjmp.h>
#include <string.h> /* memset */
typedef unsigned int unsigned32;
typedef struct {
char Area[ 0x34 ] __attribute__ ((aligned (8))) ;
} Context_Control;
typedef struct {
jmp_buf regs;
unsigned32 isr_level;
} Context_Control_overlay;
static Context_Control_overlay
_CPU_Context_Default_with_ISRs_enabled __attribute__ ((aligned
(32))) ;
static Context_Control_overlay
_CPU_Context_Default_with_ISRs_disabled __attribute__
((aligned (32))) ;
void _CPU_Context_From_CPU_Init()
{
(void) memset(
&_CPU_Context_Default_with_ISRs_enabled,
0,
sizeof(Context_Control)
);
(void) memset(
&_CPU_Context_Default_with_ISRs_disabled,
0,
sizeof(Context_Control)
);
}
int main(void)
{
_CPU_Context_From_CPU_Init();
return 0;
}
*********
$ gcc -O2 -Wall -fasm -ansi -g -o cpu cpu.c
*********
gdb output:
(gdb) r
Starting program:
/home/projects/coresw/rtems/solaris/c/src/exec/score/cpu/unix/cpu
Program received signal SIGBUS, Bus error.
0x107f8 in _CPU_Context_From_CPU_Init () at cpu.c:28
28 (void) memset(
(gdb) x /i $pc
0x107f8 <_CPU_Context_From_CPU_Init+48>:
std %o0, [ %g2 + 0x19c ] ! 0x2199c
<_CPU_Context_Default_with_ISRs_disabled>
(gdb) info register
g0 0x0 0
g1 0xef7616f8 -277473544
g2 0x21800 137216
g3 0x0 0
g4 0x0 0
g5 0x0 0
g6 0x0 0
g7 0x0 0
o0 0x0 0
o1 0x0 0
o2 0x4 4
o3 0x10000 65536
o4 0x2 2
o5 0xef77da10 -277358064
sp 0xeffff328 -268438744
o7 0x10820 67616
l0 0xef780780 -277346432
l1 0x0 0
l2 0xef7d3ac0 -277005632
l3 0x8 8
l4 0x4 4
l5 0x4 4
l6 0x7 7
l7 0xef77b580 -277367424
i0 0x0 0
i1 0xeffff3fc -268438532
i2 0xeffff404 -268438524
i3 0x21940 137536
i4 0x0 0
i5 0x0 0
fp 0xeffff398 -268438632
i7 0x106b8 67256
y 0x0 0
psr 0x40400086 1077936262
wim 0x0 0
tbr 0x0 0
pc 0x107f8 67576
npc 0x107fc 67580
fpsr 0x820 2080
cpsr 0x0 0
--
Chris Johns Networks, Plessey Asia Pacfic Pty. Ltd.
mailto:ccj@acm.org mailto:cjohns@plessey.com.au
More information about the Gcc
mailing list