bug in CTZ
CTZ is not correct for unsigned types such as uint!
Example:
noinline
int foo( uint a)
{
b = _lt_SxS_ ( 0ui, a);
return _toi_S_( b);
}
int main ()
{
return foo( 2ui );
}
CTZ turns the body into (sac2c -bopt):
int _MAIN::foo( uint a { ,NN } )
/*
* foo :: ---
*/
{
uint _esd_13 { , NN } ;
int _flat_1 { , NN } ;
bool b { , NN } ;
_esd_13 = _neg_S_( a);
b = _lt_SxS_( _esd_13, 0ui);
_flat_1 = _toi_S_( b);
return( _flat_1);
}
which clearly is not legal as neg_S is illegal. The fact that the type inference does not complain about it shows that the type inference is not correct for neg on unsigned types either :-) So it is two bugs for the price of one.