This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18065] usual arithmetic conversion not applying correctly
- From: "schlie at comcast dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2004 20:50:13 -0000
- Subject: [Bug tree-optimization/18065] usual arithmetic conversion not applying correctly
- References: <20041019202143.18065.schlie@comcast.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From schlie at comcast dot net 2004-12-21 20:50 -------
(although not the most elegant fix)
This fixes the rest of the problem, as there's no reaon to default promote smaller than int sized
integers to int, they will end up being promoted if required by the back-end if the target requires
them to be (also should not need to litterally promote enum's and bool beyond the smallest int
type with suffecient to represent it's value range):
(called via default_conversion() to determine if an expression should be converted by default to int)
*** In File: c-common.c ***
bool
c_promoting_integer_type_p (tree t)
{
switch (TREE_CODE (t))
{
- case INTEGER_TYPE:
- return (TYPE_MAIN_VARIANT (t) == char_type_node
- || TYPE_MAIN_VARIANT (t) == signed_char_type_node
- || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node
- || TYPE_MAIN_VARIANT (t) == short_integer_type_node
- || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node
- || TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node)); pws--*/
-
case ENUMERAL_TYPE:
/* ??? Technically all enumerations not larger than an int
promote to an int. But this is used along code paths
that only want to notice a size change. */
return TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node);
case BOOLEAN_TYPE:
return 1;
default:
return 0;
}
}
*** end ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18065