From: Richard Biener <rguenther@suse.de>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH] tree-optimization/108449 - keep maybe_special_function_p behavior
Date: Mon, 23 Jan 2023 07:29:54 +0000 (UTC) [thread overview]
Message-ID: <nycvar.YFH.7.77.849.2301230728060.6551@jbgna.fhfr.qr> (raw)
In-Reply-To: <Y8xYAzaVwdBVWZ90@kam.mff.cuni.cz>
On Sat, 21 Jan 2023, Jan Hubicka wrote:
> > When we have a static declaration without definition we diagnose
> > that and turn it into an extern declaration. That can alter
> > the outcome of maybe_special_function_p here and there's really
> > no point in doing that, so don't.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
> >
> > Thanks,
> > Richard.
> >
> > PR tree-optimization/108449
> > * cgraphunit.cc (check_global_declaration): Do not turn
> > undefined statics into externs.
> Looks OK to me. I got kind of suprrised we still have
> maybe_special_function_p and we do chane of public flag.
Yeah, well ...
> I wonder if we can run into similar problem when promoting declaration
> at LTO time?
Possibly - I guess we could amend maybe_special_function_p to check
if there's a visible definition. Or somehow get rid of this thing
and apply the special-function 'name' thing as explicit attributes
during parsing instead ...
Richard.
> Honza
> >
> > * gcc.dg/pr108449.c: New testcase.
> > ---
> > gcc/cgraphunit.cc | 2 --
> > gcc/testsuite/gcc.dg/pr108449.c | 5 +++++
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> > create mode 100644 gcc/testsuite/gcc.dg/pr108449.c
> >
> > diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
> > index 59ce2708b7b..832818d651f 100644
> > --- a/gcc/cgraphunit.cc
> > +++ b/gcc/cgraphunit.cc
> > @@ -1087,8 +1087,6 @@ check_global_declaration (symtab_node *snode)
> > else
> > warning (OPT_Wunused_function, "%q+F declared %<static%> but never "
> > "defined", decl);
> > - /* This symbol is effectively an "extern" declaration now. */
> > - TREE_PUBLIC (decl) = 1;
> > }
> >
> > /* Warn about static fns or vars defined but not used. */
> > diff --git a/gcc/testsuite/gcc.dg/pr108449.c b/gcc/testsuite/gcc.dg/pr108449.c
> > new file mode 100644
> > index 00000000000..4a3ae5b3ed4
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.dg/pr108449.c
> > @@ -0,0 +1,5 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-O" } */
> > +
> > +static int vfork(); /* { dg-warning "used but never defined" } */
> > +void f() { vfork(); }
> > --
> > 2.35.3
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)
prev parent reply other threads:[~2023-01-23 7:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 9:46 Richard Biener
2023-01-21 21:24 ` Jan Hubicka
2023-01-23 7:29 ` Richard Biener [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=nycvar.YFH.7.77.849.2301230728060.6551@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=jakub@redhat.com \
/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).