This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Miscompilation of glibc with CVS mainline
- From: Ulrich Drepper <drepper at redhat dot com>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: "Martin v. Löwis" <martin at v dot loewis dot de>, jakub at redhat dot com, aj at suse dot de, gcc at gcc dot gnu dot org, libc-alpha at sources dot redhat dot com
- Date: Thu, 02 Jan 2003 11:42:27 -0800
- Subject: Re: Miscompilation of glibc with CVS mainline
- Organization: Red Hat, Inc.
- References: <200301021851.h02Ipmek011007@hiauly1.hia.nrc.ca>
John David Anglin wrote:
> I can't seem to find where the standard says &weak_func is always
> unequal to null.
Of course you cannot. Weak functions are nothing ISO C defines. They
are not even a universally available features which are available on all
platforms which gcc provides.
The problem here is that somebody thought s/he can be very clever and
add one more optimization without knowing the history of gcc. We had
problems with exactly this situation several times over the last years
and always it has been the case that gcc was adjusted to *not* remove
the test. Some documentation of this behavior was even added, somewhere.
If you think about when the "optimization" can be used, it is very
questionable at best whether it's useful. Why would anybody add a test
for a function reference being NULL without the possibility of this
being the case? For this reason and the history of code like this gcc
should never remove the tests and the old behavior should be restored.
--
--------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------