From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28573 invoked from network); 16 Jul 1999 08:56:48 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Jul 1999 08:56:48 -0000 Received: (qmail 11491 invoked by alias); 16 Jul 1999 08:56:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7168 Received: (qmail 11484 invoked from network); 16 Jul 1999 08:56:38 -0000 Date: Fri, 16 Jul 1999 10:56:36 +0200 (MET DST) Message-Id: <199907160856.KAA18577@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: mason@primenet.com.au's message of 16 Jul 1999 08:26:13 GMT Subject: Re: Bad optimisations: (Was: Test version zsh-3.1.6-test-1) mason@primenet.com.au wrote: > Sven Wischnowsky typed: > :Geoff Wing wrote: > :> What about just expanding it slightly (with appropriate comments of course) > :> instead of duplicating it. > :> e.g. > :> if (*args && **args == '?') > :> args++; > :> /* default result parameter */ > :> if (*args) > :> reply = *args++; > :> else > :> reply = ops['A'] ? "reply" : "REPLY"; > :Note this isn't intended as an optimisation (of course), but to work > :around a bug in gcc-2.8.1 under DU. > > I thought it may be a gcc optimisation bug. i.e. Does it appear at -O0 or > -01 or -O2? All of them? Yes, it is. The problem is in the first two lines of the code above. If there is only the `args++' in the `then'-branch, `args' contains a random value after the `if'. This happens with all optimisation levels, so I guess it's a register allocation problem in the backend. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de