diff options
author | Richard Stallman <rms@gnu.org> | 1992-07-19 01:09:39 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-07-19 01:09:39 +0000 |
commit | 6c9e1cb25102e3d5d2b67c2a18e7563d3c04ec8b (patch) | |
tree | 045de22c45c8839a748673295497426b01c823c5 | |
parent | fea868cb1ae8d33a1f486def9a2b2dc561f021a3 (diff) | |
download | gcc-6c9e1cb25102e3d5d2b67c2a18e7563d3c04ec8b.zip gcc-6c9e1cb25102e3d5d2b67c2a18e7563d3c04ec8b.tar.gz gcc-6c9e1cb25102e3d5d2b67c2a18e7563d3c04ec8b.tar.bz2 |
(build_binary_op): Don't set shorten for signed division.
From-SVN: r1623
-rw-r--r-- | gcc/c-typeck.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 42d2be0..7b93429 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; |