diff options
author | Richard Stallman <rms@gnu.org> | 1992-08-07 07:21:41 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-08-07 07:21:41 +0000 |
commit | e83d45c45e9155cb449b3ce70afabc175b572d29 (patch) | |
tree | 35efb7725d5857d9e6e4fc7f1a7410c558e34622 /gcc | |
parent | 5f31db15fb889f85b61ba657406581b71874b434 (diff) | |
download | gcc-e83d45c45e9155cb449b3ce70afabc175b572d29.zip gcc-e83d45c45e9155cb449b3ce70afabc175b572d29.tar.gz gcc-e83d45c45e9155cb449b3ce70afabc175b572d29.tar.bz2 |
(default_conversion): Fix bug that
promotes short to unsigned if sizeof(short) == sizeof(int).
From-SVN: r1784
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-typeck.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 52c3c21..0cd4bff 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -910,10 +910,11 @@ default_conversion (exp) if (C_PROMOTING_INTEGER_TYPE_P (type)) { - /* Traditionally, unsignedness is preserved in default promotions. */ - if ((flag_traditional && TREE_UNSIGNED (type)) - /* Also preserve unsignedness if not really getting any wider. */ - || (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))) + /* Traditionally, unsignedness is preserved in default promotions. + Also preserve unsignedness if not really getting any wider. */ + if (TREE_UNSIGNED (type) + && (flag_traditional + || TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))) return convert (unsigned_type_node, exp); return convert (integer_type_node, exp); } |