diff --git a/Expression.pas b/Expression.pas index b4980ae..f825ec5 100644 --- a/Expression.pas +++ b/Expression.pas @@ -1414,7 +1414,11 @@ var op1 := op1 * op2; slashch : begin {/} if op2 = 0 then begin - Error(109); + if not (kind in [normalExpression, + autoInitializerExpression]) then + Error(109) + else if ((lint & lintOverflow) <> 0) then + Error(129); op2 := 1; end; {if} if unsigned then @@ -1424,7 +1428,11 @@ var end; percentch : begin {%} if op2 = 0 then begin - Error(109); + if not (kind in [normalExpression, + autoInitializerExpression]) then + Error(109) + else if ((lint & lintOverflow) <> 0) then + Error(129); op2 := 1; end; {if} if unsigned then @@ -1570,7 +1578,11 @@ var asteriskch : umul64(llop1, llop2); {*} slashch : begin {/} if (llop2.lo = 0) and (llop2.hi = 0) then begin - Error(109); + if not (kind in [normalExpression, + autoInitializerExpression]) then + Error(109) + else if ((lint & lintOverflow) <> 0) then + Error(129); llop2 := longlong1; end; {if} if unsigned then @@ -1580,7 +1592,11 @@ var end; percentch : begin {%} if (llop2.lo = 0) and (llop2.hi = 0) then begin - Error(109); + if not (kind in [normalExpression, + autoInitializerExpression]) then + Error(109) + else if ((lint & lintOverflow) <> 0) then + Error(129); llop2 := longlong1; end; {if} if unsigned then diff --git a/cc.notes b/cc.notes index b0adcf6..0e0de79 100644 --- a/cc.notes +++ b/cc.notes @@ -1596,6 +1596,8 @@ If you use #pragma debug 0x0010 to enable stack check debug code, the compiler w 3. In , the error code devListFull was misspelled as defListFull. +4. A compile error is no longer reported for code that divides an integer constant by zero (e.g. 1/0). Such code will produce undefined behavior if it is executed, but since the compiler cannot always determine whether the code will be executed at run time, this is no longer treated as an error that prevents compilation. If #pragma lint bit 5 is set, a lint message about the division by zero will still be produced. An error will also still be reported for division by zero in constant expressions that need to be evaluated at compile time. + -- Bugs from C 2.1.1 B3 that have been fixed in C 2.2.0 --------------------- 1. There were various bugs that could cause incorrect code to be generated in certain cases. Some of these were specific to certain optimization passes, alone or in combination.