From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28890 invoked from network); 16 Jul 1999 09:20:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Jul 1999 09:20:52 -0000 Received: (qmail 13588 invoked by alias); 16 Jul 1999 09:20:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7171 Received: (qmail 13581 invoked from network); 16 Jul 1999 09:20:43 -0000 Date: Fri, 16 Jul 1999 11:20:41 +0200 (MET DST) Message-Id: <199907160920.LAA18757@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Fri, 16 Jul 1999 10:45:19 +0200 Subject: Re: Bad optimisations: (Was: Test version zsh-3.1.6-test-1) Peter Stephenson wrote: > Sven Wischnowsky wrote: > > Playing some more: both > > > > firstarg = (*args && **args == '?' ? *args++ : *args); > > > > and > > > > if (*args && **args == '?') > > firstarg = *args++; > > else > > firstarg = *args; > > > > work around the bug, too. Should I send a patch for one of these? They > > probably keep the code better readable (although they don't look much > > less silly). > > That might look a bit neater. You'd better send it relative to the altered > code, so I don't have to spend all of 30 seconds backing that off. Yup. Bye Sven --- os/builtin.c Fri Jul 16 08:35:14 1999 +++ Src/builtin.c Fri Jul 16 11:19:35 1999 @@ -3261,16 +3261,10 @@ nchars = 1; args++; } - - firstarg = *args; - if (*args && **args == '?') { - args++; - /* default result parameter */ - reply = *args ? *args++ : ops['A'] ? "reply" : "REPLY"; - /* (If we put this reply=... after the `if' gcc-2.8.1 under - Digital Unix 4.0 generates incorrect code.) */ - } else - reply = *args ? *args++ : ops['A'] ? "reply" : "REPLY"; + /* This `*args++ : *args' looks a bit weird, but it works around a bug + * in gcc-2.8.1 under DU 4.0. */ + firstarg = (*args && **args == '?' ? *args++ : *args); + reply = *args ? *args++ : ops['A'] ? "reply" : "REPLY"; if (ops['A'] && *args) { zwarnnam(name, "only one array argument allowed", NULL, 0); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de