[Mplayer-cvslog] CVS: main/libmpdemux open.c,1.52,1.53
Jürgen Keil
jkeil at mplayerhq.hu
Fri Sep 6 15:31:49 CEST 2002
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv13008
Modified Files:
open.c
Log Message:
SPARC gcc generates bad code accessing an unaligned and packed structure member
(See gcc problem report PR c/7847); mplayer crashes with SIGBUS signal.
Added a workaround: copy the unaligned stucture member to a temporary local
variable using memcpy, and use that in the code.
Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- open.c 5 Aug 2002 00:39:07 -0000 1.52
+++ open.c 6 Sep 2002 13:31:33 -0000 1.53
@@ -654,8 +654,23 @@
if(d->angle_seek){
int i,skip=0;
+#if defined(__GNUC__) && defined(__sparc__)
+ // workaround for a bug in the sparc version of gcc 2.95.X ... 3.2,
+ // it generates incorrect code for unaligned access to a packed
+ // structure member, resulting in an mplayer crash with a SIGBUS
+ // signal.
+ //
+ // See also gcc problem report PR c/7847:
+ // http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&cmd=view+audit-trail&pr=7847
+ for(i=0;i<9;i++){ // check if all values zero:
+ typeof(d->dsi_pack.sml_agli.data[i].address) tmp_addr;
+ memcpy(&tmp_addr,&d->dsi_pack.sml_agli.data[i].address,sizeof(tmp_addr));
+ if((skip=tmp_addr)!=0) break;
+ }
+#else
for(i=0;i<9;i++) // check if all values zero:
if((skip=d->dsi_pack.sml_agli.data[i].address)!=0) break;
+#endif
if(skip){
// sml_agli table has valid data (at least one non-zero):
d->cur_pack=d->dsi_pack.dsi_gi.nv_pck_lbn+
More information about the MPlayer-cvslog
mailing list