Some debugging tools don't like if a code uses unitialized variables. The code in cpu.c uses the value of fxsr.buff[50], so it makes sense to explicitely initialize it (because fxsave can fail to do it). -------------- next part -------------- A non-text attachment was scrubbed... Name: cpu_init_val.patch Type: application/octet-stream Size: 409 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20151012/2f4eb2e0/attachment.obj
lvqcl wrote:> Some debugging tools don't like if a code uses unitialized variables. > The code in cpu.c uses the value of fxsr.buff[50], so it makes sense > to explicitely initialize it (because fxsave can fail to do it).Your change: fxsr.buff[50] = 0; only changes one element in that 128 work buffer. Why explicitly initialize onky the 50th element and not all of them? My approach would be: memset (fxsr.buff, 0, sizeof (fxsr.buff)); What do you think? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:>> Some debugging tools don't like if a code uses unitialized variables. >> The code in cpu.c uses the value of fxsr.buff[50], so it makes sense >> to explicitely initialize it (because fxsave can fail to do it). > > Your change: > > fxsr.buff[50] = 0; > > only changes one element in that 128 work buffer. Why explicitly initialize > onky the 50th element and not all of them?The C code that follows: ... old_val = fxsr.buff[50]; fxsr.buff[50] ^= 0x0013c0de; ... fxsr.buff[50] = old_val; ... new_val = fxsr.buff[50]; fxsr.buff[50] = old_val; ... uses only fxsr.buff[50], so IMHO it's enough to initialize only the value of this element.> My approach would be: > > memset (fxsr.buff, 0, sizeof (fxsr.buff)); > > What do you think?It won't hurt but probably superfluous.