This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: PATCH to set_sizetype to set TYPE_CANONICAL
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 03 Apr 2009 23:18:41 -0400
- Subject: RFA: PATCH to set_sizetype to set TYPE_CANONICAL
A change that I've been playing with revealed that set_sizetype isn't
setting TYPE_CANONICAL properly on sizetype; it ends up pointing to the
the dummy type that we copied into sizetype rather than to sizetype
itself. I'm not aware of anything that currently breaks as a result,
but if C++ gets more serious about using canonical types in templates
build_int_cst_wide blows up when we try to make constants using the
dummy type.
OK for trunk?
2009-04-03 Jason Merrill <jason@redhat.com>
* stor-layout.c (set_sizetype): Set TYPE_CANONICAL.
Index: stor-layout.c
===================================================================
*** stor-layout.c (revision 145500)
--- stor-layout.c (working copy)
*************** set_sizetype (tree type)
*** 2070,2075 ****
--- 2070,2076 ----
/* Replace our original stub sizetype. */
memcpy (sizetype, t, tree_size (sizetype));
TYPE_MAIN_VARIANT (sizetype) = sizetype;
+ TYPE_CANONICAL (sizetype) = sizetype;
t = make_node (INTEGER_TYPE);
TYPE_NAME (t) = get_identifier ("bit_size_type");
*************** set_sizetype (tree type)
*** 2084,2089 ****
--- 2085,2091 ----
/* Replace our original stub bitsizetype. */
memcpy (bitsizetype, t, tree_size (bitsizetype));
TYPE_MAIN_VARIANT (bitsizetype) = bitsizetype;
+ TYPE_CANONICAL (bitsizetype) = bitsizetype;
if (TYPE_UNSIGNED (type))
{