public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/89990] request warning: Use of out of scope compound literals
Date: Tue, 07 May 2024 04:55:09 +0000 [thread overview]
Message-ID: <bug-89990-4-9Qo98EfSOV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-89990-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89990
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew D'Addesio from comment #7)
>
> This actually has gotten me curious. Would you have an idea/explanation
> behind that 2 function call threshold @Andrew Pinski?
Most likely it is due to jump threading optimization not happening if there are
2 calls while it is happening with 1. That is the growth of copying 1 call is
reasonable while 2 is not when removing the extra jump.
That is transforming:
```
int test(int x)
{
const unsigned char buf[32];
const struct mytype *ptr = &d;
if (x != 0)
ptr = &(const struct mytype){ 43 };
foo(buf);
#ifdef CALL_FOO_TWICE
foo(buf);
#endif
return ptr->c;
}
```
into something like:
```
int test(int x)
{
const unsigned char buf[32];
const struct mytype *ptr;
if (x != 0) goto a; else goto b;
a:
{
ptr = &(const struct mytype){ 43 };
}
foo(buf);
#ifdef CALL_FOO_TWICE
foo(buf);
#endif
return ptr->c;
b:
foo(buf);
#ifdef CALL_FOO_TWICE
foo(buf);
#endif
return d.c;
}
```
Where doing 2 copies of 2 calls is too expensive to be done.
prev parent reply other threads:[~2024-05-07 4:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-89990-4@http.gcc.gnu.org/bugzilla/>
2020-03-31 2:34 ` modchipv12 at gmail dot com
2024-04-09 7:32 ` pinskia at gcc dot gnu.org
2024-04-09 7:33 ` pinskia at gcc dot gnu.org
2024-05-07 2:42 ` modchipv12 at gmail dot com
2024-05-07 4:55 ` pinskia at gcc dot gnu.org [this message]
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-89990-4-9Qo98EfSOV@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).