Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(170)

Issue 5622053: code review 5622053: test: test slice beyond len (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 5 months ago by iant
Modified:
13 years, 5 months ago
Reviewers:
CC:
golang-dev, rsc, iant2
Visibility:
Public.

Description

test: test slice beyond len When slicing a slice, the bounds may be > len as long as they are <= cap. Interestingly, gccgo got that wrong and still passed the testsuite and all the library tests.

Patch Set 1 #

Patch Set 2 : diff -r b6e94b31350e https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -0 lines) Patch
M test/ken/array.go View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 7
iant
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 5 months ago (2012-02-02 23:05:59 UTC) #1
rsc
LGTM
13 years, 5 months ago (2012-02-02 23:06:27 UTC) #2
rsc
It must be the lower bound that was the problem? Surely the upper bound being ...
13 years, 5 months ago (2012-02-02 23:07:02 UTC) #3
iant2
Russ Cox <rsc@golang.org> writes: > It must be the lower bound that was the problem? ...
13 years, 5 months ago (2012-02-03 14:29:03 UTC) #4
iant
*** Submitted as http://code.google.com/p/go/source/detail?r=04ca0ed4614a *** test: test slice beyond len When slicing a slice, the ...
13 years, 5 months ago (2012-02-03 14:29:38 UTC) #5
rsc
On Fri, Feb 3, 2012 at 09:28, Ian Lance Taylor <iant@google.com> wrote: > Yes, I ...
13 years, 5 months ago (2012-02-03 14:41:33 UTC) #6
iant2
13 years, 5 months ago (2012-02-03 16:38:13 UTC) #7
Russ Cox <rsc@golang.org> writes:

> On Fri, Feb 3, 2012 at 09:28, Ian Lance Taylor <iant@google.com> wrote:
>> Yes, I was comparing the lower bound against len rather than cap.
>
> FWIW, I believe that for [lo:hi] the simplest check is
> lo <= hi && hi <= cap; lo doesn't have to be compared
> against either len or cap.

Yeah, I will do that when I disentangle ordinary index expressions from
slice expressions.

Ian
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b