View Issue Details

IDProjectCategoryView StatusLast Update
0002955ardourbugspublic2020-04-19 20:14
Reporterjohne53 Assigned Topaul  
PrioritynormalSeverityminorReproducibilityrandom
Status closedResolutionfixed 
Product Version2.8.3 
Summary0002955: PBD::FPU::has_denormals_are_zero() uses an unitialised buffer
DescriptionI noticed that PBD::FPU::has_denormals_are_zero() was giving me different results, depending on whether I compiled in Debug mode or Release mode. I found the following code in libs//pbd/fpu.cc

    asm volatile (
        "fxsave (%0)"
        :
        : "r" (fxbuf)
        : "memory"
    );

    uint32_t mxcsr_mask = *((uint32_t*) &fxbuf[28]);

where 'fxbuf' is an aligned buffer of 512 bytes. Unfortunately, the x86's 'fxsave' instruction doesn't guarantee to touch all bytes in the supplied buffer and fxbuf[28] is one that isn't guaranteed to get written. Therefore it's important to ensure that the buffer is in a known state before calling fxsave.

I added "memset(fxbuf, 0, 512);" just before the call to the inline assembly and now I'm getting consistent results.
TagsNo tags attached.

Activities

paul

2009-12-31 17:54

administrator   ~0007274

fix applied to 3.0 and 2.X along with some inline asm fixes for the cpuid (revs 6419-6421). thanks for tracking this down.

system

2020-04-19 20:14

developer   ~0022013

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2009-12-12 13:41 johne53 New Issue
2009-12-31 17:54 paul cost => 0.00
2009-12-31 17:54 paul Note Added: 0007274
2009-12-31 17:54 paul Status new => resolved
2009-12-31 17:54 paul Resolution open => fixed
2009-12-31 17:54 paul Assigned To => paul
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:30 cth103 Category bugs2 => bugs
2020-04-19 20:14 system Note Added: 0022013
2020-04-19 20:14 system Status resolved => closed