From: Richard Stallman Date: Sun, 19 Jul 1992 01:09:39 +0000 (+0000) Subject: (build_binary_op): Don't set shorten for signed division. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c9e1cb25102e3d5d2b67c2a18e7563d3c04ec8b;p=gcc.git (build_binary_op): Don't set shorten for signed division. From-SVN: r1623 --- diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 42d2be0686d..7b9342914a1 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2283,7 +2283,9 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) if (!(code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)) resultcode = RDIV_EXPR; else - shorten = 1; + /* When dividing two signed integers, you have to promote to int. + E.g. (short) -32868 / (short) -1 doesn't fit in a short. */ + shorten = TREE_UNSIGNED (op0); common = 1; } break;