public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/114931] [14/15 regression] ICE in get_alias_set when building tcl with -std=c23
Date: Fri, 03 May 2024 07:25:57 +0000	[thread overview]
Message-ID: <bug-114931-4-gjG9za6UXB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114931-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114931

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
So a real fix might look like the following (requiring changes in all other
type builders to first set/compute the canonical type of course).

diff --git a/gcc/tree.cc b/gcc/tree.cc
index 83f3bf306af..5dfe12f0e96 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -6012,6 +6012,9 @@ type_hash_canon_hash (tree type)

   hstate.add_int (TREE_CODE (type));

+  if (TYPE_CANONICAL (type))
+    hstate.add_object (TYPE_HASH (TYPE_CANONICAL (type)));
+
   if (TREE_TYPE (type))
     hstate.add_object (TYPE_HASH (TREE_TYPE (type)));

@@ -6109,6 +6112,9 @@ type_cache_hasher::equal (type_hash *a, type_hash *b)
          || TYPE_MODE (a->type) != TYPE_MODE (b->type)))
     return false;

+  if (TYPE_CANONICAL (a->type) != TYPE_CANONICAL (b->type))
+    return false;
+
   switch (TREE_CODE (a->type))
     {
     case VOID_TYPE:
@@ -7507,10 +7513,6 @@ build_function_type (tree value_type, tree arg_types,
       TYPE_NO_NAMED_ARGS_STDARG_P (t) = 1;
     }

-  /* If we already have such a type, use the old one.  */
-  hashval_t hash = type_hash_canon_hash (t);
-  t = type_hash_canon (hash, t);
-
   /* Set up the canonical type. */
   any_structural_p   = TYPE_STRUCTURAL_EQUALITY_P (value_type);
   any_noncanonical_p = TYPE_CANONICAL (value_type) != value_type;
@@ -7523,6 +7525,16 @@ build_function_type (tree value_type, tree arg_types,
     TYPE_CANONICAL (t) = build_function_type (TYPE_CANONICAL (value_type),
                                              canon_argtypes);

+  /* If we already have such a type, use the old one.  */
+  hashval_t hash = type_hash_canon_hash (t);
+  t = type_hash_canon (hash, t);
+
   if (!COMPLETE_TYPE_P (t))
     layout_type (t);
   return t;

  parent reply	other threads:[~2024-05-03  7:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03  2:37 [Bug rtl-optimization/114931] New: " sjames at gcc dot gnu.org
2024-05-03  2:38 ` [Bug rtl-optimization/114931] " sjames at gcc dot gnu.org
2024-05-03  2:43 ` [Bug c/114931] " pinskia at gcc dot gnu.org
2024-05-03  2:52 ` pinskia at gcc dot gnu.org
2024-05-03  3:10 ` sjames at gcc dot gnu.org
2024-05-03  6:34 ` [Bug c/114931] [14/15 regression] " rguenth at gcc dot gnu.org
2024-05-03  7:11 ` rguenth at gcc dot gnu.org
2024-05-03  7:16 ` rguenth at gcc dot gnu.org
2024-05-03  7:25 ` rguenth at gcc dot gnu.org [this message]
2024-05-03  7:41 ` jakub at gcc dot gnu.org
2024-05-03  7:56 ` rguenth at gcc dot gnu.org
2024-05-03  8:22 ` rguenth at gcc dot gnu.org
2024-05-03  8:25 ` jakub at gcc dot gnu.org
2024-05-03  9:01 ` rguenth at gcc dot gnu.org
2024-05-03  9:05 ` rguenth at gcc dot gnu.org
2024-05-03  9:50 ` rguenth at gcc dot gnu.org
2024-05-03 11:01 ` cvs-commit at gcc dot gnu.org
2024-05-07  7:46 ` rguenth at gcc dot gnu.org
2024-05-07 11:05 ` cvs-commit at gcc dot gnu.org
2024-05-07 11:07 ` [Bug c/114931] [14 " rguenth at gcc dot gnu.org
2024-05-07 12:30 ` rguenth at gcc dot gnu.org
2024-05-07 18:10 ` sjames at gcc dot gnu.org
2024-05-15 16:09 ` cvs-commit at gcc dot gnu.org
2024-05-15 16:09 ` cvs-commit at gcc dot gnu.org
2024-05-15 16:09 ` rguenth at gcc dot gnu.org

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=bug-114931-4-gjG9za6UXB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).