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 debug/108656] [12/13 Regression] '-fcompare-debug' failure (length) w/ -O2 -fno-ipa-pure-const -fno-tree-dce --param early-inlining-insns=0 since r12-5236
Date: Mon, 06 Feb 2023 10:03:55 +0000	[thread overview]
Message-ID: <bug-108656-4-HAHmUs5xPG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108656-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #7)
> (In reply to Richard Biener from comment #6)
> > (In reply to Jakub Jelinek from comment #5)
> > > Created attachment 54412 [details]
> > > gcc13-pr108656.patch
> > > 
> > > So shall we fix it like this then?
> > 
> > But isn't this the wrong "side"?  returns_twice means it is the abnormal
> > control _receiver_, it doesn't perform an abnormal goto itself.
> > 
> > stmt_starts_bb_p is correct here, so where does it go wrong?
> 
> I think it needs both.  The thing is, when it returns the second time, it
> does that again by returning from itself, not through returning from some
> unrelated function.
> Say, if we have pure + returns_twice call and no other call in a function,
> the abnormal edge to the pure + returns_twice call would be optimized away,
> even when the call remains, because there would be no edge from some call to
> the .ABNORMAL_DISPATCHER block.
> __attribute__((pure, returns_twice)) int foo (void);
> 
> int
> bar (void)
> {
>   for (int i = 0; i < 64; ++i)
>     {
>       int x = foo ();
>       if (x == 26)
>         return -42;
>     }
>   return 42;
> }
> doesn't even have because of this any abnormal edges created.
> Or, if there is some other non-pure call somewhere else, we model through
> the abnormal
> edges that that other call can pass control back to the start of the
> returns_twice call to make it return again.

Ah, but then the issue is that we assume that 'foo' doesn't longjmp,
independent on whether it is returns_twice or not?  Can a setjmp ()
function perform a longjmp () to its own context?  Would it even appear
as returning twice then?  Would calling setjmp in a loop like above
and then jumping to another iteration via longjmp even be valid?

That said, for your example I would think not having any abnormal edges
is correct - there's no frame that could transfer control back to the
returns_twice receiver, no?

  parent reply	other threads:[~2023-02-06 10:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 11:00 [Bug debug/108656] New: [12/13 Regression] '-fcompare-debug' failure (length) w/ -O2 -fno-ipa-pure-const -fno-tree-dce --param early-inlining-insns=0 asolokha at gmx dot com
2023-02-03 11:03 ` [Bug debug/108656] " asolokha at gmx dot com
2023-02-03 11:12 ` [Bug debug/108656] [12/13 Regression] '-fcompare-debug' failure (length) w/ -O2 -fno-ipa-pure-const -fno-tree-dce --param early-inlining-insns=0 since r12-5236 jakub at gcc dot gnu.org
2023-02-03 13:13 ` jakub at gcc dot gnu.org
2023-02-06  7:42 ` rguenth at gcc dot gnu.org
2023-02-06  8:49 ` jakub at gcc dot gnu.org
2023-02-06  9:46 ` rguenth at gcc dot gnu.org
2023-02-06  9:56 ` jakub at gcc dot gnu.org
2023-02-06 10:03 ` rguenth at gcc dot gnu.org [this message]
2023-02-06 10:11 ` jakub at gcc dot gnu.org
2023-02-06 10:14 ` jakub at gcc dot gnu.org
2023-02-06 10:22 ` rguenther at suse dot de
2023-02-06 10:37 ` jakub at gcc dot gnu.org
2023-02-07 11:28 ` rguenther at suse dot de
2023-05-08 12:26 ` [Bug debug/108656] [12/13/14 " 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-108656-4-HAHmUs5xPG@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).