From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6548 invoked by alias); 2 Jan 2003 17:48:39 -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 6489 invoked from network); 2 Jan 2003 17:48:37 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by 209.249.29.67 with SMTP; 2 Jan 2003 17:48:37 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id h02HmOot010841; Thu, 2 Jan 2003 12:48:25 -0500 (EST) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id h02HmOnf010840; Thu, 2 Jan 2003 12:48:24 -0500 (EST) Message-Id: <200301021748.h02HmOnf010840@hiauly1.hia.nrc.ca> Subject: Re: Miscompilation of glibc with CVS mainline To: dave@hiauly1.hia.nrc.ca (John David Anglin) Date: Thu, 02 Jan 2003 17:48:00 -0000 From: "John David Anglin" Cc: jakub@redhat.com, aj@suse.de, gcc@gcc.gnu.org, libc-alpha@sources.redhat.com In-Reply-To: from "John David Anglin" at Jan 2, 2003 12:38:24 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2003-01/txt/msg00049.txt.bz2 > > > Here's a small testcase that has the same behaviour: > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > extern void weak_func (void *arg); > > > asm (".weak weak_func"); > > > > > > void > > > test (void *arg) > > > { > > > if (&weak_func != (void *)0) > > > weak_func (arg); > > > > > > } > > > > 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: > > stw %r2,-20(%r30) > ldo 64(%r30),%r30 > ldw -84(%r30),%r2 > bl weak_func,%r0 > ldo -64(%r30),%r30 > > We have completely lost the `if'. As a result, weak_func is always > called. There is another problem. The call to weak_func has been turned into a sibcall. It seems that TARGET_FUNCTION_OK_FOR_SIBCALL isn't being consulted as we don't allow indirect sibcalls on hppa-linux. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605)