2008-01-13 Borut Razem <borut.razem AT siol.net>
* support/scripts/sdcc.nsi: added Uninstall/reinstall page, ...
+ *src/SDCCicode.c: fixed bug #1870216 - Error 122: dividing by zero
+
+2007-12-30 Borut Razem <borut.razem AT siol.net>
+
+ * src/pic16/gen.c: fixed implementation of bitwise operations for
+ pic16targer
+ * support/regression/tests/bitwise.c: added test cases
2007-12-29 Borut Razem <borut.razem AT siol.net>
operandLitValue (right)));
break;
case '/':
- if ((TYPE_TARGET_ULONG) double2ul (operandLitValue (right)) == 0)
+ if (IS_UNSIGNED (type))
{
- werror (E_DIVIDE_BY_ZERO);
- retval = right;
-
+ if ((TYPE_TARGET_ULONG) double2ul (operandLitValue (right)) == 0)
+ {
+ werror (E_DIVIDE_BY_ZERO);
+ retval = right;
+ }
+ SPEC_USIGN (let) = 1;
+ SPEC_USIGN (ret) = 1;
+ retval = operandFromValue (valCastLiteral (type,
+ (TYPE_TARGET_ULONG) double2ul (operandLitValue (left)) /
+ (TYPE_TARGET_ULONG) double2ul (operandLitValue (right))));
}
else
{
- if (IS_UNSIGNED (type))
+ if (operandLitValue (right) == 0)
{
- SPEC_USIGN (let) = 1;
- SPEC_USIGN (ret) = 1;
- retval = operandFromValue (valCastLiteral (type,
- (TYPE_TARGET_ULONG) double2ul (operandLitValue (left)) /
- (TYPE_TARGET_ULONG) double2ul (operandLitValue (right))));
- }
- else
- {
- retval = operandFromValue (valCastLiteral (type,
- operandLitValue (left) /
- operandLitValue (right)));
+ werror (E_DIVIDE_BY_ZERO);
+ retval = right;
}
+ retval = operandFromValue (valCastLiteral (type,
+ operandLitValue (left) /
+ operandLitValue (right)));
}
break;
case '%':