Resolve "IVAS DEC : segmentation fault errors with "-funsafe-math-optimizations" option"
- Related issues: #1560 (closed)
- Requested reviewers: @weckbecker
Reason why this change is needed
-
The issue is in the SVD, more precisely in
biDiagonalReductionLeft()for ( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ { norm_x = 0.0f; for ( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { norm_x += ( singularVectors[jCh][currChannel] * singularVectors[jCh][iCh] ); } f = norm_x / maxWithSign( r ); for ( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */ { singularVectors[jCh][iCh] += ( f * singularVectors[jCh][currChannel] ); } }The expression
singularVectors[jCh][iCh] += ( f * singularVectors[jCh][currChannel] );becomes-inf, which results innanlater on.This can only happen in
f = norm_x / maxWithSign( r );, but the result of this expression is not available in the optimized build. As soon as I start adding e.g., aprintf(), the issue disappears.Unless we now start changing the precision of the complete SVD, I would propose addressing the issue by making the variables which store the results of expressions like
X / maxWithSign( Y )"volatile". At least for me, this seems to resolve the issue.
Description of the change
- Add volatile keyword, to avoid over-optimization
Affected operating points
- Without -funsafe-math-optimizations, everything remain bit-exact
Related to #1560 (closed)