[patch] libcpp fix div overflow

Eric Christopher echristo@apple.com
Wed May 2 01:37:00 GMT 2007


For the simple case of:

#if (-1)/2
#endif

we'll give an overflow warning for the expression. I'm pretty sure we  
don't want to do this, just as we wouldn't if someone used this in an  
enum or the result of a multiply in a preprocessor expression. So we  
should check to see whether or not our result is zero first (just like  
we do for multiply and others).

For some reason I thought that there was a bugzilla on this, but now I  
can't find it.

OK for mainline?

-eric

2007-05-01  Eric Christopher  <echristo@apple.com>

	* expr.c (num_div_op): Don't overflow if the result is
	zero.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libcpp.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070502/8d6ebda3/attachment.txt>


More information about the Gcc-patches mailing list