From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: Jason Merrill <jason@redhat.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: Mon, 29 Apr 2002 11:36:00 -0000 [thread overview]
Message-ID: <200204291959.42699@enzo.bigblue.local> (raw)
In-Reply-To: <wvl662bmqos.fsf@prospero.cambridge.redhat.com>
On Sunday 28 April 2002 23:57, Jason Merrill wrote:
> >>>>> "Franz" == Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
> >
> > + if (SUPPORTS_WEAK
> > + && DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl)
> > + && (TREE_CODE (decl) != VAR_DECL
> > + || ! TREE_STATIC (decl))
> > + && TREE_USED (decl)
> > + && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
> > + warning_with_decl (decl, "weak declaration of `%s' after first use
> > may result in unspecified behaviour");
>
> 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;
}
// case 2
extern int vfoo1i __attribute__((weak));
void * foo1i (void)
{
return (void *)&vfoo1i;
}
extern int vfoo1i __attribute__((weak));
extern int vfoo1i;
// case 3
extern int vfoo1j __attribute__((weak));
void * foo1j (void)
{
return (void *)&vfoo1j;
}
extern int vfoo1j;
extern int vfoo1j __attribute__((weak));
Actually, looking at handle_alias_attribute(), TREE_USED is exactly the flag
to test here. The addition of DECL_ASSEMBLER_NAME_SET_P seems reasonable
though. What do you think?
Franz.
next prev parent reply other threads:[~2002-04-29 17:58 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 [this message]
2002-04-30 6:20 ` Jason Merrill
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=200204291959.42699@enzo.bigblue.local \
--to=franz.sirl-kernel@lauterbach.com \
--cc=amodra@bigpond.net.au \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=jason@redhat.com \
--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).