This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C/C++ FEs: Do we really need three char_type_nodes?
- From: "Steven Bosscher" <stevenb dot gcc at gmail dot com>
- To: "Diego Novillo" <dnovillo at google dot com>
- Cc: gcc at gcc dot gnu dot org, "Jason Merrill" <jason at redhat dot com>, "Mark Mitchell" <mark at codesourcery dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Sun, 21 Sep 2008 14:28:05 +0200
- Subject: Re: C/C++ FEs: Do we really need three char_type_nodes?
- References: <b798aad50809190936h47d77128rce541f288001c74b@mail.gmail.com>
On Fri, Sep 19, 2008 at 6:36 PM, Diego Novillo <dnovillo@google.com> wrote:
> @@ -7674,12 +7713,8 @@ build_common_tree_nodes (bool signed_cha
> unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
> TYPE_STRING_FLAG (unsigned_char_type_node) = 1;
>
> - /* Define `char', which is like either `signed char' or `unsigned char'
> - but not the same as either. */
> - char_type_node
> - = (signed_char
> - ? make_signed_type (CHAR_TYPE_SIZE)
> - : make_unsigned_type (CHAR_TYPE_SIZE));
> + /* Define `char', which is like either `signed char' or `unsigned char'. */
> + char_type_node = signed_char ? signed_char_type_node :
> unsigned_char_type_node;
> TYPE_STRING_FLAG (char_type_node) = 1;
Maybe this is a totally stupid idea in the wrong direction - but would
it help to set the TYPE_CANONICAL the same, e.g.:
Index: tree.c
===================================================================
--- tree.c (revision 140524)
+++ tree.c (working copy)
@@ -7364,8 +7364,8 @@
but not the same as either. */
char_type_node
= (signed_char
- ? make_signed_type (CHAR_TYPE_SIZE)
- : make_unsigned_type (CHAR_TYPE_SIZE));
+ ? build_distinct_type_copy (signed_char_type_node)
+ : build_distinct_type_copy (unsigned_char_type_node));
TYPE_STRING_FLAG (char_type_node) = 1;
short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);
Gr.
Steven