[PATCH] Fix PR c/6343 (was: Re: GCC 3.1 Prerelease)

Jason Merrill jason@redhat.com
Thu Apr 25 12:54:00 GMT 2002


>>>>> "Franz" == Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:

> On Wednesday 24 April 2002 22:01, Jason Merrill wrote:

>> The latter.  We don't want to warn about the C++ frontend's internal
>> trickery with DECL_WEAK.

> What kind of trickery? Can I detect that in declare_weak?

In the C++ frontend, in general an entity with vague linkage (such as a
template instantion) has DECL_EXTERNAL set until EOF, at which point we
decide what to do with it.  If we can't tell whether or not this is the One
True translation unit for the entity, we mark it weak/comdat and emit it as
needed.

>> I'd prefer to omit the warning entirely on the branch.

> Well, I prefer overzealous warnings over no warning at all in the same way I 
> prefer ICEs over miscompiled code :-). Besides that extra warning, I'm really 
> satisfied now with my patch otherwise and unless you think it's overly 
> complicated to get rid of it, I would like to fix it even for the branch.

The warning should only apply to weak externs; the address of a weak
definition is never 0.  That should fix the C++ case above.

Jason



More information about the Gcc-patches mailing list