sumit_tuwien Posted October 16, 2013 Report Share Posted October 16, 2013 Hi All, There are many points where there are division by 0 observed and can show up any time. We have found no protection mechanism for that. One such example (sysc/datatypes/fx/scfx_rep.cpp) : switch( numrep ) { case SC_BIN: case SC_BIN_US: case SC_CSD: step = 1; break; case SC_OCT: case SC_OCT_US: step = 3; break; case SC_HEX: case SC_HEX_US: step = 4; break; default: step = 0; } msb = (int) ceil( double( msb + 1 ) / step ) * step - 1; lsb = (int) floor( double( lsb ) / step ) * step; if( msb < 0 ) { s += '.'; if( fmt == SC_F ) { int sign = ( b.is_neg() ) ? ( 1 << step ) - 1 : 0; for( int i = ( msb + 1 ) / step; i < 0; i ++ ) { if numrep defaults, there will be division by zero. Functionally it never showed up, still there is a chance this will be triggered. We can share the complete lint report if you are interested. Regards, Sumit Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted October 16, 2013 Report Share Posted October 16, 2013 As in the other post about dereferencing NULL pointers, I suspect that (all of?) these reports are false positives as well. If you want to silence the linter about these, just add calls to explicitily non-returning functions like std::terminate. On the other hand, a division by zero will usually abort your simulation as well. ;-) /Philipp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.