On Tue, 10 Sep 2013 18:16:01 +0200 Tijl Coosemans wrote: > I've attached a small test program extracted from multimedia/gstreamer-ffmpeg > (libavcodec/h264_cabac.c:ff_h264_init_cabac_states(H264Context *h)). > > When you compile and run it like this on FreeBSD/i386, it results in a > SIGBUS: > > % cc -o paddd paddd.c -O3 -msse2 -fPIE -fomit-frame-pointer > % ./paddd > Bus error > > The reason is this instruction where %esp isn't 16-byte aligned: > paddd (%esp), %xmm7 > > Is this an upstream bug or is this because of local changes (to make the > stack 4 byte aligned by default or something)?
Sigh, let me just inline the attachment:
#define NUM 16
signed char state[NUM];
signed char tab[NUM][2];
void
init_states(int slice) {
int i;
/* calculate pre-state */
for( i= 0; i < NUM; i++ ) {
int pre = 2*(((tab[i][0] * slice) >>4 ) + tab[i][1]) - 127;
pre^= pre>>31;
if(pre > 124)
pre= 124 + (pre&1);
state[i] = pre;
}
}
int
main(void) {
init_states(10);
}
signature.asc
Description: PGP signature
