From: Jason Merrill <jason@redhat.com>
To: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
Cc: gcc-patches@gcc.gnu.org, Richard Henderson <rth@redhat.com>,
Alan Modra <amodra@bigpond.net.au>,
Mark Mitchell <mark@codesourcery.com>,
gcc@gcc.gnu.org
Subject: Re: [PATCH] Fix PR c/6343 (was: Re: GCC 3.1 Prerelease)
Date: Tue, 30 Apr 2002 06:20:00 -0000 [thread overview]
Message-ID: <wvln0vljyc0.fsf@prospero.cambridge.redhat.com> (raw)
In-Reply-To: <200204291959.42699@enzo.bigblue.local> (Franz Sirl's message of "Mon, 29 Apr 2002 19:59:42 +0200")
>>>>> "Franz" == Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
> On Sunday 28 April 2002 23:57, Jason Merrill wrote:
>> I intended that TREE_SYMBOL_REFERENCED should be used rather than
>> TREE_USED, not in addition. I'd probably check DECL_ASSEMBLER_NAME_SET_P
>> here, too; if the name hasn't been generated, it hasn't been referenced.
>> Perhaps we want a new macro, say
>>
>> #define DECL_SYMBOL_REFERENCED(DECL) \
>> (DECL_ASSEMBLER_NAME_SET_P (DECL) \
>> && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)))
> But this would warn for these cases, which I think isn't correct:
> // case 1
> extern void * ffoo1g (void);
> extern void * ffoox1g (void);
> extern void * ffoo1g (void) __attribute__((weak, alias ("ffoox1g")));
> void * foo1g (void)
> {
> if (ffoo1g)
> ffoo1g ();
> return 0;
> }
I don't see why this would get a warning.
> // case 2
> extern int vfoo1i __attribute__((weak));
> void * foo1i (void)
> {
> return (void *)&vfoo1i;
> }
> extern int vfoo1i __attribute__((weak));
> extern int vfoo1i;
I suppose this (and case 3) might get a warning from calling declare_weak
on the later decls. It seems to me that we don't want to call declare_weak
on newdecl, since we're only going to throw it away. Adding it to
weak_decls prevents gc from discarding it.
> Actually, looking at handle_alias_attribute(), TREE_USED is exactly the
> flag to test here.
I suppose that if there's a reference which hasn't been emitted yet, we
could get a false negative here. So yes, TREE_USED is right for
declare_weak, and not TREE_SYMBOL_REFERENCED.
My patch actually used TREE_SYMBOL_REFERENCED in weak_finish, at which
point all references should have been emitted. Of course, if you make
that change while all the duplicate decls go on weak_decls, we'd end up
weakening the symbol once for each decl.
> The addition of DECL_ASSEMBLER_NAME_SET_P seems reasonable though.
If we aren't looking at DECL_ASSEMBLER_NAME, there's no reason to look at
_SET_P.
So never mind. If you want to tweak the patch to avoid duplication on
weak_decls, that might be good for the trunk, but your last patch should be
fine for the branch.
Thanks,
Jason
next prev parent reply other threads:[~2002-04-30 12:26 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-23 2:12 GCC 3.1 Prerelease Mark Mitchell
2002-04-23 3:53 ` Alan Modra
2002-04-23 4:13 ` Franz Sirl
2002-04-23 4:32 ` Alan Modra
2002-04-23 10:40 ` Franz Sirl
2002-04-23 11:42 ` Richard Henderson
2002-04-23 15:08 ` Franz Sirl
2002-04-23 15:10 ` Richard Henderson
2002-04-24 10:56 ` Jason Merrill
2002-04-24 12:04 ` Franz Sirl
2002-04-24 13:03 ` Richard Henderson
2002-04-24 13:14 ` Jason Merrill
2002-04-25 12:57 ` [PATCH] Fix PR c/6343 (was: Re: GCC 3.1 Prerelease) Franz Sirl
2002-04-25 12:59 ` Jason Merrill
2002-04-28 8:44 ` Franz Sirl
2002-04-28 11:59 ` Mark Mitchell
2002-04-28 15:00 ` Jason Merrill
2002-04-28 16:36 ` Mark Mitchell
2002-04-29 11:36 ` Franz Sirl
2002-04-30 6:20 ` Jason Merrill [this message]
2002-04-30 9:40 ` Mark Mitchell
2002-04-23 12:22 ` GCC 3.1 Prerelease Jason Merrill
2002-04-23 9:08 ` Per Bothner
2002-04-23 9:30 ` Mark Mitchell
2002-04-23 10:12 ` Per Bothner
2002-04-23 13:25 ` Mark Mitchell
2002-04-23 14:52 ` Tom Tromey
2002-04-23 15:02 ` Per Bothner
2002-04-23 16:11 ` Tom Tromey
2002-04-24 10:14 ` Alexandre Petit-Bianco
2002-04-24 10:30 ` Tom Tromey
2002-04-24 10:32 ` Mark Mitchell
2002-04-23 13:19 ` Richard Henderson
2002-04-23 13:28 ` Mark Mitchell
2002-04-23 13:35 ` Richard Henderson
2002-04-23 13:50 ` Mark Mitchell
2002-04-23 13:52 ` Richard Henderson
2002-04-23 16:30 ` mips n64 eh failures Richard Henderson
2002-04-23 16:53 ` Mark Mitchell
2002-04-23 16:59 ` Richard Henderson
2002-04-23 18:00 ` Richard Henderson
2002-04-23 18:20 ` Richard Henderson
2002-04-23 19:35 ` Richard Henderson
2002-04-24 9:08 ` Mark Mitchell
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=wvln0vljyc0.fsf@prospero.cambridge.redhat.com \
--to=jason@redhat.com \
--cc=Franz.Sirl-kernel@lauterbach.com \
--cc=amodra@bigpond.net.au \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=mark@codesourcery.com \
--cc=rth@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).