public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "muecker at gwdg dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/114574] [14 regression] ICE when building curl with LTO (fld_incomplete_type_of, at ipa-free-lang-data.cc:257) since r14-9763
Date: Thu, 04 Apr 2024 07:57:13 +0000	[thread overview]
Message-ID: <bug-114574-4-wZUTvepSc6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114574-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #14 from Martin Uecker <muecker at gwdg dot de> ---
(In reply to Jakub Jelinek from comment #12)
> Not an expert on TYPE_CANONICAL, but my understanding is that non-NULL
> TYPE_CANONICAL is just an optimization to speed up type comparisons (but it
> seems c-typeck.cc doesn't actually use that, so it is mainly middle-end
> then).
> See how e.g. cp/typeck.cc (comptypes) will do structural_comptypes if at
> least one TYPE_CANONICAL is NULL (aka TYPE_STRUCTURAL_EQUALITY_P), and
> otherwise at least without checking will rely on TYPE_CANONICAL comparison
> and that is it.
> So, having TYPE_CANONICAL NULL should just be slower, but not wrong (as long
> as comptypes etc. works correctly).  Having TYPE_CANONICAL non-NULL and not
> actually matching could cause type comparisons to think types are the same
> when they aren't or vice versa.
> 
> Now, when you set TYPE_CANONICAL on completion of the flag_isoc23
> aggregates, you could surely also update TYPE_CANONICAL of the variant types
> using build_qualified_type and perhaps pointers too, just to handle the
> common case.  But unlike the case where the TYPE_CANONICAL of the aggregate
> TYPE_MAIN_VARIANT would be initially different, you wouldn't need to chase
> down everything, including TYPE_CANONICAL on FUNCTION_TYPE which have
> pointers to array type of array type of pointer of pointer of qualified
> pointer to the aggregate etc., just the common things.
> And setting TYPE_CANONICAL just based on the tag would be also wrong, if one
> can define struct S { int s; }; in one scope and struct S { int a, b; }; in
> another scope and those types are supposed to be different.


According to my understanding, setting based on tag would form larger
equivalence classes, so should give correct code but suboptimal aliasing
analysis.

There are two general issues I see here.

1.) The middle end idea of type compatibility is not necessarily the same as
the language semantics. In particular type compatibility in C is not based on
mutual equivalence, so any mechanism based on forming equivalence classes using
TYPE_CANONICAL can only be an approximation (which to be correct, must be less
precise than the language semantics). 

2.) If compatibility relationship changes for types (as it the case when
completing types, then we either have to use an equivalence class that does not
need to change (e.g. based on tags) or only use structural equivalency, or
upgrade structural equivalency to the  equivalency class for the completed type
if this is allowed.

  parent reply	other threads:[~2024-04-04  7:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 12:42 [Bug lto/114574] New: [14 regression] ICE when building curl with LTO (internal compiler error: in fld_incomplete_type_of, at ipa-free-lang-data.cc:257) sjames at gcc dot gnu.org
2024-04-03 13:07 ` [Bug lto/114574] [14 regression] ICE when building curl with LTO (fld_incomplete_type_of, " sjames at gcc dot gnu.org
2024-04-03 13:30 ` sjames at gcc dot gnu.org
2024-04-03 14:15 ` [Bug lto/114574] [14 regression] ICE when building curl with LTO (fld_incomplete_type_of, at ipa-free-lang-data.cc:257) since r14-9763 jakub at gcc dot gnu.org
2024-04-03 15:51 ` jakub at gcc dot gnu.org
2024-04-03 15:57 ` jakub at gcc dot gnu.org
2024-04-03 18:02 ` uecker at gcc dot gnu.org
2024-04-04  5:29 ` uecker at gcc dot gnu.org
2024-04-04  6:14 ` uecker at gcc dot gnu.org
2024-04-04  6:46 ` jakub at gcc dot gnu.org
2024-04-04  7:07 ` uecker at gcc dot gnu.org
2024-04-04  7:18 ` rguenth at gcc dot gnu.org
2024-04-04  7:21 ` jakub at gcc dot gnu.org
2024-04-04  7:48 ` muecker at gwdg dot de
2024-04-04  7:57 ` muecker at gwdg dot de [this message]
2024-04-04 13:21 ` muecker at gwdg dot de
2024-04-05  5:16 ` muecker at gwdg dot de
2024-04-05  7:12 ` jakub at gcc dot gnu.org
2024-04-05  7:38 ` muecker at gwdg dot de
2024-04-05  7:45 ` jakub at gcc dot gnu.org
2024-04-05  7:51 ` muecker at gwdg dot de
2024-04-05  7:58 ` jakub at gcc dot gnu.org
2024-04-05  8:40 ` jakub at gcc dot gnu.org
2024-04-05 10:17 ` cvs-commit at gcc dot gnu.org
2024-04-06  5:46 ` xry111 at gcc dot gnu.org
2024-04-12 13:36 ` law at gcc dot gnu.org
2024-04-12 15:55 ` jakub at gcc dot gnu.org
2024-04-12 16:57 ` uecker at gcc dot gnu.org
2024-04-12 17:07 ` jakub at gcc dot gnu.org
2024-04-12 21:06 ` uecker at gcc dot gnu.org
2024-04-18 11:57 ` jakub at gcc dot gnu.org
2024-04-18 13:18 ` muecker at gwdg dot de
2024-04-19  8:20 ` jakub at gcc dot gnu.org
2024-04-19  8:30 ` jakub at gcc dot gnu.org
2024-04-19  8:35 ` pinskia at gcc dot gnu.org
2024-04-19 22:11 ` cvs-commit at gcc dot gnu.org
2024-04-19 22:25 ` jakub 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-114574-4-wZUTvepSc6@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).