This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] remove the unsigned_type language hook
Nope, these testcases still fail even after the patch you just sent.
I bet if you try doing -funsigned-char when compiling this testcase,
they will fail on i686-linux-gnu.
They did, and now I think I have the complete fix. The problem was
that with my patch, get_unsigned_type would return the wrong char
type. So tests like
unsigned_type_for(x) == unsigned_type_for(y)
would fail, because one call would return a "unsigned char" and the
other one a "char".
The attached patch fixed the problem on x86_64 + -funsigned_char.
Could you please give it a try?
Thanks,
Andrew Pinski
Thanks,
--
Rafael Avila de Espindola
Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland
Registered in Dublin, Ireland
Registration Number: 368047
--- gcc/c-common.c (revision 124811)
+++ gcc/c-common.c (local)
@@ -2066,9 +2066,6 @@ tree
c_common_signed_or_unsigned_type (int unsignedp, tree type)
{
tree type1;
- if (!INTEGRAL_TYPE_P (type)
- || TYPE_UNSIGNED (type) == unsignedp)
- return type;
/* This block of code emulates the behavior of the old
c_common_unsigned_type. In particular, it returns
@@ -2111,6 +2108,10 @@ c_common_signed_or_unsigned_type (int un
types, and producing a signed or unsigned variant of an
ENUMERAL_TYPE may cause other problems as well. */
+ if (!INTEGRAL_TYPE_P (type)
+ || TYPE_UNSIGNED (type) == unsignedp)
+ return type;
+
#define TYPE_OK(node) \
(TYPE_MODE (type) == TYPE_MODE (node) \
&& (c_dialect_cxx () || TYPE_PRECISION (type) == TYPE_PRECISION (node)))
--- gcc/langhooks.c (revision 124811)
+++ gcc/langhooks.c (local)
@@ -579,9 +579,6 @@ lhd_builtin_function (tree decl)
tree
get_signed_or_unsigned_type (int unsignedp, tree type)
{
- if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
- return type;
-
return lang_hooks.types.signed_or_unsigned_type(unsignedp, type);
}
@@ -590,5 +587,8 @@ get_signed_or_unsigned_type (int unsigne
tree
lhd_signed_or_unsigned_type (int unsignedp, tree type)
{
+ if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
+ return type;
+
return lang_hooks.types.type_for_size (TYPE_PRECISION (type), unsignedp);
}