This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ubsan] Fix bootstrap comparison
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 23 Aug 2013 14:44:49 +0200
- Subject: Re: [ubsan] Fix bootstrap comparison
- References: <20130823123756 dot GE4968 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Aug 23, 2013 at 02:37:56PM +0200, Marek Polacek wrote:
> This patch fixes bootstrap comparison when doing bootstrap
> with -fsanitize=undefined enabled. We need to hash the UID of the
> type and also I had to switch two statements; we need to get
> TYPE_MAIN_VARIANT of the type first...
> Hence, no more bootstrap comparison failures. Woohoo!
>
> Tested x86_64-linux, applying to the ubsan branch.
>
> 2013-08-23 Marek Polacek <polacek@redhat.com>
>
> * ubsan.c (ubsan_typedesc_hasher::hash): Hash the TYPE_UID of the
> type.
> (ubsan_type_descriptor): Get TYPE_MAIN_VARIANT before initializing
> the type descriptor.
>
> --- gcc/ubsan.c.mp 2013-08-23 14:28:15.780955545 +0200
> +++ gcc/ubsan.c 2013-08-23 14:28:47.467059363 +0200
> @@ -60,7 +60,7 @@ struct ubsan_typedesc_hasher
> inline hashval_t
> ubsan_typedesc_hasher::hash (const ubsan_typedesc *data)
> {
> - return iterative_hash_object (data->type, 0);
> + return iterative_hash_object (TYPE_UID (data->type), 0);
Why not just return TYPE_UID (data->type); ?
Anyway, once you change the hash table uses into pointer_map, this will
all go away.
Jakub