From: Jakub Jelinek <jakub@redhat.com>
To: Nathan Sidwell <nathan@acm.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] complex type canonicalization
Date: Wed, 29 Nov 2017 09:39:00 -0000 [thread overview]
Message-ID: <20171129093304.GY2353@tucnak> (raw)
In-Reply-To: <384ed945-83b4-b421-ab82-92b5e236d874@acm.org>
On Tue, Nov 28, 2017 at 01:27:54PM -0500, Nathan Sidwell wrote:
> --- tree.c (revision 255202)
> +++ tree.c (working copy)
> - /* We need to create a name, since complex is a fundamental type. */
> - if (!TYPE_NAME (t) && named)
> + /* We need to create a name, since complex is a fundamental type. */
> + if (named)
> + {
> + const char *name = NULL;
> +
> + if (TREE_TYPE (t) == char_type_node)
> + name = "complex char";
> + else if (TREE_TYPE (t) == signed_char_type_node)
> + name = "complex signed char";
> + else if (TREE_TYPE (t) == unsigned_char_type_node)
> + name = "complex unsigned char";
> + else if (TREE_TYPE (t) == short_integer_type_node)
> + name = "complex short int";
> + else if (TREE_TYPE (t) == short_unsigned_type_node)
> + name = "complex short unsigned int";
> + else if (TREE_TYPE (t) == integer_type_node)
> + name = "complex int";
> + else if (TREE_TYPE (t) == unsigned_type_node)
> + name = "complex unsigned int";
> + else if (TREE_TYPE (t) == long_integer_type_node)
> + name = "complex long int";
> + else if (TREE_TYPE (t) == long_unsigned_type_node)
> + name = "complex long unsigned int";
> + else if (TREE_TYPE (t) == long_long_integer_type_node)
> + name = "complex long long int";
> + else if (TREE_TYPE (t) == long_long_unsigned_type_node)
> + name = "complex long long unsigned int";
> +
> + if (name != NULL)
> + TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
> + get_identifier (name), t);
> + }
Are you sure nothing can build_complex_type before build_common_tree_nodes
is called and builds those? If that would happen, we'd fail to add names
with your patch, while we'd add them before. The addition of TYPE_NAME
looks orthogonal to the TYPE_CANONICAL handling and type hashing.
I must also say I'm surprised that the recursive build_complex_type
call passes in named too, but as it does type comparison by pointers,
perhaps that's ok.
Otherwise LGTM.
Jakub
next prev parent reply other threads:[~2017-11-29 9:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 18:52 Nathan Sidwell
2017-11-29 9:39 ` Jakub Jelinek [this message]
2017-11-29 9:43 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171129093304.GY2353@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nathan@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).