mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 19:52:44 +00:00
sh: Remove undefined behaviour due to overflow in +/-/* in arithmetic.
With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged.
This commit is contained in:
parent
6376caed8e
commit
876f9b7800
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227369
@ -131,11 +131,11 @@ static arith_t do_binop(int op, arith_t a, arith_t b)
|
||||
yyerror("divide error");
|
||||
return op == ARITH_REM ? a % b : a / b;
|
||||
case ARITH_MUL:
|
||||
return a * b;
|
||||
return (uintmax_t)a * (uintmax_t)b;
|
||||
case ARITH_ADD:
|
||||
return a + b;
|
||||
return (uintmax_t)a + (uintmax_t)b;
|
||||
case ARITH_SUB:
|
||||
return a - b;
|
||||
return (uintmax_t)a - (uintmax_t)b;
|
||||
case ARITH_LSHIFT:
|
||||
return a << b;
|
||||
case ARITH_RSHIFT:
|
||||
|
Loading…
Reference in New Issue
Block a user