# HG changeset patch
# User Mario de Sousa <msousa@fe.up.pt>
# Date 1357237592 0
# Node ID d534db26cbd5e6b5aaafc987d17c61577880303a
# Parent  b08167f156a11ff3c9aff968406f60f6c84f02d8
Fix divide by 0 bug.

diff -r b08167f156a1 -r d534db26cbd5 stage3/constant_folding.cc
--- a/stage3/constant_folding.cc	Thu Jan 03 17:04:04 2013 +0000
+++ b/stage3/constant_folding.cc	Thu Jan 03 18:26:32 2013 +0000
@@ -448,6 +448,8 @@
 	if (!VALID_CVALUE(uint64, res))
 		return;
 	/* Test by pre-condition: If (UINT64_MAX / a) < b => overflow! */
+	if (0 == GET_CVALUE(uint64, a))
+		return; // multiplying by 0 will always result in 0, a valid result!	  
 	if ((UINT64_MAX / GET_CVALUE(uint64, a)) < GET_CVALUE(uint64, b))
 		SET_OVFLOW(uint64, res);
 }