public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106099] [13 Regression] ICE in execute_todo, at passes.cc:2134 since r13-1204-gd68d366425369649
Date: Mon, 04 Jul 2022 11:35:34 +0000	[thread overview]
Message-ID: <bug-106099-4-BUQlaeabCk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106099-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
At least for #c1 (which can be simplified to:
void
foo (void)
{
  for (unsigned i = 0; i == 0; i++)
    ;
}
), the problem is that __builtin_unreachable that was emitted by ivcanon pass
is marked const and so is __ubsan_handle_builtin_unreachable but __builtin_trap
is not.
Which means that __builtin_unreachable (looks ok) and
__ubsan_handle_builtin_unreachable (admittedly surprising) doesn't need
gimple_vdef nor gimple_vuse on it, but __builtin_trap needs it.
And ivcanon doesn't expect that and as it doesn't add the vdef manually, we
remain with something that needs SSA update but we don't ask for it in todo
flags.
At least for user calls of __builtin_trap, I think we need at least vuse on it,
unlike __builtin_unreachable for traps we do care about say stores to memory
before it so that one can investigate them, abort isn't const either.
For a noreturn function, it isn't clear if we need a vdef.
I'm afraid we need to at least investigate all the
gimple_build_builtin_unreachable callers.
E.g. in gimple-fold.cc, it calls gimple_move_vops, so if the old method call
wasn't const/pure, it will work properly, but if it was e.g. const, we won't
add it and will ICE similarly.

Perhaps one way out of this would be to use 2 different __builtin_trap
builtins, one as it is now that requires vops, and another one marked const for
the __builtin_unreachable turned into __builtin_trap which would be marked
const and wouldn't need vops (__builtin_unreachable_trap?) and expand both
builtins the same into RTL.

  parent reply	other threads:[~2022-07-04 11:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  6:52 [Bug tree-optimization/106099] New: ICE in execute_todo, at passes.cc:2134 asolokha at gmx dot com
2022-06-27  9:04 ` [Bug tree-optimization/106099] " zsojka at seznam dot cz
2022-06-27  9:07 ` [Bug tree-optimization/106099] [13 Regression] ICE in execute_todo, at passes.cc:2134 since r13-1204-gd68d366425369649 marxin at gcc dot gnu.org
2022-06-27  9:18 ` pinskia at gcc dot gnu.org
2022-06-27 10:48 ` rguenth at gcc dot gnu.org
2022-07-04 10:10 ` marxin at gcc dot gnu.org
2022-07-04 10:12 ` marxin at gcc dot gnu.org
2022-07-04 11:35 ` jakub at gcc dot gnu.org [this message]
2022-07-04 11:38 ` jakub at gcc dot gnu.org
2022-07-26 10:25 ` jakub at gcc dot gnu.org
2022-07-28 10:43 ` cvs-commit at gcc dot gnu.org
2022-07-30  8:22 ` zsojka at seznam dot cz
2022-08-26  7:29 ` cvs-commit at gcc dot gnu.org
2022-10-18 13:02 ` jakub at gcc dot gnu.org
2023-01-03 11:23 ` 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-106099-4-BUQlaeabCk@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).