author | Mario de Sousa <msousa@fe.up.pt> |
Thu, 03 Jan 2013 19:31:12 +0000 | |
changeset 786 | c370918ca7fb |
parent 785 | b08167f156a1 |
child 791 | ab601bdea102 |
--- a/stage3/constant_folding.cc Thu Jan 03 17:04:04 2013 +0000 +++ b/stage3/constant_folding.cc Thu Jan 03 19:31:12 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); }