Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 62341 invoked from network); 3 Jun 2008 18:45:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jun 2008 18:45:33 -0000 Received: (qmail 88185 invoked by uid 500); 3 Jun 2008 18:45:36 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 88172 invoked by uid 500); 3 Jun 2008 18:45:36 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 88161 invoked by uid 99); 3 Jun 2008 18:45:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2008 11:45:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 66.249.82.236 as permitted sender) Received: from [66.249.82.236] (HELO wx-out-0506.google.com) (66.249.82.236) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2008 18:44:46 +0000 Received: by wx-out-0506.google.com with SMTP id i30so1168614wxd.2 for ; Tue, 03 Jun 2008 11:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=FGgVrhF0J2WIhXB7cWU45OwHP3bnpCRMz/tgOnUrIko=; b=dcinVkEeCLNGaxq4RaP09p2DTC0vtvAiT4+VPqsK89LUkAtJcvW7oyi1xlT2N3wjIEmNVFyUSoHSCzpp66gzE0x1MBD1Vk+VvlEyCPVCOA0PEaA49+HCSqBbYkJGb0mnwynU+itf2Ln2KAm3tYE4CBVSJagivSb6UP/CJeFIB5M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=GLYVCmfxZrW5u8cTz0VRqDBiqzdqUCIFurjyPy39vpF81y9NIZHDRsxp36ueXj7+7DGxtRvzpoJK+KLxZg6Shb5LwpCEuhee7uoxRVR8DpezJQIZE8XNoQPjrQoAaMvD6vEIavCIK3g1vmptPsSD8k2o2PolEH0Z6BUshNrrJR0= Received: by 10.90.87.7 with SMTP id k7mr13622687agb.25.1212518703039; Tue, 03 Jun 2008 11:45:03 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id 3sm206581hsw.13.2008.06.03.11.45.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 03 Jun 2008 11:45:02 -0700 (PDT) Message-ID: <4845912C.8030305@roguewave.com> Date: Tue, 03 Jun 2008 12:45:00 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: [jira] Commented: (STDCXX-901) 26.class.gslice test fails References: <1685660362.1212456165037.JavaMail.jira@brutus> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Travis Vitek wrote: > > >> Martin Sebor commented on STDCXX-901: >> ------------------------------------- >> >> This is from the binary incompatible rewrite of {{valarray}} >> that I've been mentioning for eons (I should finally commit it >> on trunk). If it fixes this bug it might spark an idea for a >> compatible fix... >> > > Martin, > > I'm struggling with what appears to a discrepancy between the standard > and the two implementations I'm testing with. You mean a bug? ;-) > According to > lib.gslice.cons, a default constructed slice specifies no elements. > Section lib.class.gslice describes gslices that do have lengths and > strides. The example it gives is shown here > [...] > Assume for a moment that we have the following gslice... > > start = 0 > length = { 0 } > stride = { 0 } > > So the indices specified by this slice should be > > k = 0 + () * 0 Or just k = 0 because the sum is zero. > > i0, i1, k > (0, (), 0) // = 0 + () * 0 > > So this slice should be a view of 0th element in a given array. That's my reading too. > > I wrote a quick testcase to make sure that I was understanding this > gslice stuff correctly. It creates a valarray and a slice from strings, > then assigns 0 to the resulting gslice_array. This zeros out all > elements specified by the slice. Here is the set of testcases... > > int main () > { > // + length > // | +- stride > // | | > // v v > test ("1@10", 0, "", ""); > test ("1@10", 0, "0", "0"); > test ("1@10", 0, "1", "1"); > test ("1@10", 0, "1", "2"); > test ("1@10", 0, "1", "3"); > > test ("1@10", 0, "2", "1"); > test ("1@10", 0, "2", "2"); > test ("1@10", 0, "3", "3"); > test ("1@10", 0, "2", "3"); > > test ("1@10", 0, "5", "1"); > test ("1@10", 1, "5", "1"); > test ("1@10", 1, "5,2", "1,2"); > > test ("1@10", 0, "0,0,0", "1,2,3"); > > return 0; > } > [...] > The STLPort and RW implementations both get stuck in an infinite loop on > the second testcase, so I'm pretty sure that they're broken. I can't > find anything in the standard that says this would be unspecified or > undefined behavior and I don't see anything that calls this out as a > special case. This leads me to believe that this is a bug in both > implementations and I should take it into consideration when applying > any fix. I agree. There's more than one way to refer to the same slice. Unless it's computationally expensive to avoid, none of them should enter an infinite loop or any other kind of undefined behavior. Martin