[M3devel] signed overflow warnings in hand.c

Jay K jay.krell at cornell.edu
Sun Jan 17 00:39:09 CET 2010


In C signed overflow is not defined.

Sometimes compilers take advantage of that and make optimizations assuming there is no overflow.

 

 

$ gcc-4 -O2 -Wstrict-overflow=4 -c hand.c
hand.c: In function `m3_div':
hand.c:244: warning: assuming signed overflow does not occur when distributing n
egation across division
hand.c:245: warning: assuming signed overflow does not occur when distributing n
egation across division
hand.c: In function `m3_divL':
hand.c:256: warning: assuming signed overflow does not occur when distributing n
egation across division
hand.c:257: warning: assuming signed overflow does not occur when distributing n
egation across division

jay at jay1 /cygdrive/c/dev2/cm3/m3-libs/m3core/src/Csupport/Common

 

 

Is there a way to write this using unsigned math only?

 

I was expecting warnings on the new functions unused functions I added.

 

 - Jay

 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100116/8526917b/attachment-0001.html>


More information about the M3devel mailing list