From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5939 invoked by alias); 2 Jan 2003 17:48:14 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 5184 invoked from network); 2 Jan 2003 17:47:02 -0000 Received: from unknown (HELO mailout03.sul.t-online.com) (194.25.134.81) by 209.249.29.67 with SMTP; 2 Jan 2003 17:47:02 -0000 Received: from fwd09.sul.t-online.de by mailout03.sul.t-online.com with smtp id 18U9QW-00014O-0B; Thu, 02 Jan 2003 18:46:40 +0100 Received: from v.loewis.de (03047300346-0001@[217.232.24.94]) by fmrl09.sul.t-online.com with esmtp id 18U9QQ-0bNH8qC; Thu, 2 Jan 2003 18:46:34 +0100 Message-ID: <3E147AFA.3000600@v.loewis.de> Date: Thu, 02 Jan 2003 17:48:00 -0000 From: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.2.1) Gecko/20021130 X-Accept-Language: de, en-us, en MIME-Version: 1.0 To: John David Anglin CC: jakub@redhat.com, aj@suse.de, gcc@gcc.gnu.org, libc-alpha@sources.redhat.com Subject: Re: Miscompilation of glibc with CVS mainline References: <200301021738.h02HcP43010808@hiauly1.hia.nrc.ca> In-Reply-To: <200301021738.h02HcP43010808@hiauly1.hia.nrc.ca> X-Enigmail-Version: 0.71.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Sender: 03047300346-0001@t-dialin.net X-SW-Source: 2003-01/txt/msg00048.txt.bz2 John David Anglin wrote: >>As GCC is not told in any way that weak_func is actually weak, I think >>it is glibc's fault. > > > This is definitely a gcc problem. This is the code arising from > Andreas' testcase for hppa-linux at -O2: [...] > We have completely lost the `if'. As a result, weak_func is always > called. It's not a gcc bug. weak_func is a function, so &weak_func is always unequal to null - that is guaranteed by the C programming language. That's why the compiler is entitled to eliminate the test, under the as-if rule. If you want to declare a function whose address can be zero, you need to declare it weak, using the relevant extension in GNU C. Regards, Martin