Should the test file be called arrayequal.go instead of equal.go?? http://codereview.appspot.com/6452046/diff/1002/test/equal.go File test/equal.go (right): http://codereview.appspot.com/6452046/diff/1002/test/equal.go#newcode22 ...
12 years, 10 months ago
(2012-07-26 04:40:58 UTC)
#2
On 2012/07/26 04:40:58, nigeltao wrote: > Should the test file be called arrayequal.go instead of ...
12 years, 10 months ago
(2012-07-26 05:29:13 UTC)
#3
On 2012/07/26 04:40:58, nigeltao wrote:
> Should the test file be called arrayequal.go instead of equal.go??
i moved the test file to fixedbugs/bug447.go in Patch Set 5.
in fact, the bug is in runtime.equal, and i suspect "struct {uint8}" could also
fail, so equal.go is a better name (i only test the array case, because the
length of arguments is what matters)
> http://codereview.appspot.com/6452046/diff/1002/test/equal.go#newcode22
> test/equal.go:22: fmt.Fprintf(bout, "package main\n")
> Would `` strings make some of this easier?
probable, i thought backquote make the left margin ragged if used inline.
anyway, i changed to use backquote string.
> http://codereview.appspot.com/6452046/diff/1002/test/equal.go#newcode35
> test/equal.go:35: fmt.Fprintf(bout, "\treturn v == [%d]uint8{2}\n}\n", i)
> Can we test for false negatives as well as false positives?
sure. i should have tested false negatives, because it will catch more
situations in theory.
On 2012/07/26 06:00:37, nigeltao wrote: > For backquote strings, I was imagining something more like ...
12 years, 10 months ago
(2012-07-26 06:20:00 UTC)
#5
On 2012/07/26 06:00:37, nigeltao wrote:
> For backquote strings, I was imagining something more like the program below.
> WDYT?
This is much better, thank you very much!
http://codereview.appspot.com/6452046/diff/17003/test/fixedbugs/bug447.go File test/fixedbugs/bug447.go (right): http://codereview.appspot.com/6452046/diff/17003/test/fixedbugs/bug447.go#newcode7 test/fixedbugs/bug447.go:7: package main please put a comment here that explains ...
12 years, 10 months ago
(2012-07-26 15:53:10 UTC)
#7
I found a new problem: this test is not future-proof. this test depends on gc ...
12 years, 10 months ago
(2012-07-26 18:18:36 UTC)
#8
I found a new problem: this test is not future-proof.
this test depends on gc generating call to runtime.equal for comparing
instance of
T and T's underlying type, but this need not to be the case in the future.
Do I need to find a new way to test this?
On 27 July 2012 04:18, minux <minux.ma@gmail.com> wrote: > I found a new problem: this ...
12 years, 10 months ago
(2012-07-26 23:22:52 UTC)
#10
On 27 July 2012 04:18, minux <minux.ma@gmail.com> wrote:
> I found a new problem: this test is not future-proof.
>
> this test depends on gc generating call to runtime.equal for comparing
> instance of
> T and T's underlying type, but this need not to be the case in the future.
>
> Do I need to find a new way to test this?
My opinion is that you should test the language, not the
implementation. So if a future version of gc doesn't use
runtime·equal, this test is still valid, and should still pass.
On Thu, Jul 26, 2012 at 4:22 PM, Nigel Tao <nigeltao@golang.org> wrote: > My opinion ...
12 years, 10 months ago
(2012-07-26 23:30:56 UTC)
#11
On Thu, Jul 26, 2012 at 4:22 PM, Nigel Tao <nigeltao@golang.org> wrote:
> My opinion is that you should test the language, not the
> implementation. So if a future version of gc doesn't use
> runtime·equal, this test is still valid, and should still pass.
>
so i suppose i should enhance the test to cover more equality test case?
On 27 July 2012 09:30, minux <minux.ma@gmail.com> wrote: > so i suppose i should enhance ...
12 years, 10 months ago
(2012-07-26 23:34:35 UTC)
#12
On 27 July 2012 09:30, minux <minux.ma@gmail.com> wrote:
> so i suppose i should enhance the test to cover more equality test case?
I think what you have now is fine. It tests that a particular bug is fixed.
A hypothetical future change may make this test no longer test a
particular code path in the compiler and runtime, but it is still a
correct program with respect to the language.
On 2012/07/26 15:53:10, r wrote: http://codereview.appspot.com/6452046/diff/17003/test/fixedbugs/bug447.go#newcode7 > test/fixedbugs/bug447.go:7: package main > please put a comment ...
12 years, 10 months ago
(2012-07-27 00:11:20 UTC)
#13
http://codereview.appspot.com/6452046/diff/7/test/fixedbugs/bug447.go File test/fixedbugs/bug447.go (right): http://codereview.appspot.com/6452046/diff/7/test/fixedbugs/bug447.go#newcode9 test/fixedbugs/bug447.go:9: // return values into account; so in certain cases, ...
12 years, 10 months ago
(2012-07-27 00:16:28 UTC)
#14
i'm wondering if we need to round y according to t->align also. (see patch set ...
12 years, 10 months ago
(2012-07-30 22:32:19 UTC)
#17
i'm wondering if we need to round y according to t->align also.
(see patch set 14)
i think for our current usage of runtime.align, y doesn't need
to be aligned by t->align, but adding alignment there would
make us safer if we extend usage of runtime.equal in the future.
what do you think?
http://codereview.appspot.com/6452046/diff/17009/src/pkg/runtime/alg.c File src/pkg/runtime/alg.c (right): http://codereview.appspot.com/6452046/diff/17009/src/pkg/runtime/alg.c#newcode475 src/pkg/runtime/alg.c:475: y = x + ROUND(t->size, t->align); This is fine ...
12 years, 10 months ago
(2012-08-01 21:26:27 UTC)
#20
On 2012/08/01 21:26:27, rsc wrote: http://codereview.appspot.com/6452046/diff/17009/src/pkg/runtime/alg.c#newcode475 > src/pkg/runtime/alg.c:475: y = x + ROUND(t->size, t->align); > ...
12 years, 9 months ago
(2012-08-06 02:05:05 UTC)
#22
On 2012/08/01 21:26:27, rsc wrote:
http://codereview.appspot.com/6452046/diff/17009/src/pkg/runtime/alg.c#newcod...
> src/pkg/runtime/alg.c:475: y = x + ROUND(t->size, t->align);
> This is fine but also unnecessary. t->size must necessarily be a multiple of
> t->align. Otherwise the second element in an array of two elements would be
> misaligned.
what i am think is this:
runtime.align is not designed for comparing array only, is it?
if we ever pass non-array type T to it, then the extra round is necessary,
right?
> what i am think is this: > runtime.align is not designed for comparing array ...
12 years, 9 months ago
(2012-08-06 19:48:09 UTC)
#23
> what i am think is this:
> runtime.align is not designed for comparing array only, is it?
> if we ever pass non-array type T to it, then the extra round is
> necessary, right?
no. a type T's size is always a multiple of its alignment.
the array was only an example of why this must be true (so that every
element of [10]T is properly aligned). arrays don't have to be
involved for it to be true. it's always true.
russ
On 2012/08/06 19:48:09, rsc wrote: > no. a type T's size is always a multiple ...
12 years, 9 months ago
(2012-08-07 01:41:38 UTC)
#24
On 2012/08/06 19:48:09, rsc wrote:
> no. a type T's size is always a multiple of its alignment.
> the array was only an example of why this must be true (so that every
> element of [10]T is properly aligned). arrays don't have to be
> involved for it to be true. it's always true.
ok, i was confused by some ROUND code in hashmap.c,
and i understand now. will remove this unneeded ROUND.
Issue 6452046: code review 6452046: runtime: round return value address in runtime.equal
(Closed)
Created 12 years, 10 months ago by minux1
Modified 12 years, 9 months ago
Reviewers: dave_cheney.net, rsc
Base URL:
Comments: 11