Re: Serious bug in TypeInfo_Array (Was: Re: Need help locating AA bug)

2012-02-29 Thread James Miller
On 29 February 2012 21:24, Walter Bright wrote: > On 2/28/2012 11:01 PM, H. S. Teoh wrote: >> >> But now I've found the >> cause of the inconsistent hash problem. > > > Good catch, I'll fix it. > Wow, serious bug caused by 14 characters, insane.

Re: Serious bug in TypeInfo_Array (Was: Re: Need help locating AA bug)

2012-02-29 Thread Walter Bright
On 2/28/2012 11:01 PM, H. S. Teoh wrote: But now I've found the cause of the inconsistent hash problem. Good catch, I'll fix it.

Serious bug in TypeInfo_Array (Was: Re: Need help locating AA bug)

2012-02-28 Thread H. S. Teoh
Alright, so I made a fool of myself in my last post by not looking for the class hierarchy of TypeInfo in object.d. But now I've found the cause of the inconsistent hash problem. For an int[], the typeid is TypeInfo_Ai. Here's the implementation of TypeInfo_Ai.getHash(): override hash_t getHa

Re: Need help locating AA bug

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 12:04:45PM -0800, Walter Bright wrote: > On 2/28/2012 7:20 AM, H. S. Teoh wrote: > >That's strange, because I'm clearly seeing a difference in hash > >value. Calling map1's keyti.getHash(key) yields a different value > >from map2's keyti.getHash(key). > > The thing to do t

Re: Need help locating AA bug

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 12:04:45PM -0800, Walter Bright wrote: > On 2/28/2012 7:20 AM, H. S. Teoh wrote: > >That's strange, because I'm clearly seeing a difference in hash > >value. Calling map1's keyti.getHash(key) yields a different value > >from map2's keyti.getHash(key). > > The thing to do t

Re: Need help locating AA bug

2012-02-28 Thread Walter Bright
On 2/28/2012 7:20 AM, H. S. Teoh wrote: That's strange, because I'm clearly seeing a difference in hash value. Calling map1's keyti.getHash(key) yields a different value from map2's keyti.getHash(key). The thing to do then is look at those two getHash functions, and see how they are computing

Re: Need help locating AA bug

2012-02-28 Thread H. S. Teoh
On Mon, Feb 27, 2012 at 09:15:45PM -0800, Walter Bright wrote: > On 2/27/2012 5:28 PM, H. S. Teoh wrote: > >1) Why does map2's internal TypeInfo get set to int[] instead of > >const(int)[]? > > There shouldn't be any difference, as far as aa's go. > > >2) Why does map1[key] use int[]'s version of

Re: Need help locating AA bug

2012-02-27 Thread Walter Bright
On 2/27/2012 5:28 PM, H. S. Teoh wrote: 1) Why does map2's internal TypeInfo get set to int[] instead of const(int)[]? There shouldn't be any difference, as far as aa's go. 2) Why does map1[key] use int[]'s version of getHash() even though map1's TypeInfo actually points to const(int)[]? Th

constness of AA keys (Was: Re: Need help locating AA bug)

2012-02-27 Thread H. S. Teoh
On Mon, Feb 27, 2012 at 09:34:11PM -0500, Jonathan M Davis wrote: [...] > The keys to AA's are supposed to be _immutable_. Really, this should > be enforced by the compiler (and it is on some level, but not to the > point that code like int[int[]] is illegal like it should be). The > fact that the

Re: Need help locating AA bug

2012-02-27 Thread Jonathan M Davis
On Monday, February 27, 2012 17:28:17 H. S. Teoh wrote: > On Mon, Feb 27, 2012 at 02:41:27PM -0800, H. S. Teoh wrote: > > I'm investigating issue 7512, and narrowed down the problem to a bug > > somewhere in the code that handles AA literals. > > [...] > > OK, I've found the cause of the problem.

Re: Need help locating AA bug

2012-02-27 Thread H. S. Teoh
On Mon, Feb 27, 2012 at 02:41:27PM -0800, H. S. Teoh wrote: > I'm investigating issue 7512, and narrowed down the problem to a bug > somewhere in the code that handles AA literals. [...] OK, I've found the cause of the problem. Suppose you have an int array: const int[] key = [1,2,3,4];

Re: Need help locating AA bug

2012-02-27 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 12:24:08AM +0100, David Nadlinger wrote: > On Monday, 27 February 2012 at 22:39:47 UTC, H. S. Teoh wrote: > >[…] But I don't understand what's the difference between > >_d_assocarrayliteralT() and _d_assocarrayliteralTX()? When are they > >called, and in which context? > >

Re: Need help locating AA bug

2012-02-27 Thread David Nadlinger
On Monday, 27 February 2012 at 22:39:47 UTC, H. S. Teoh wrote: […] But I don't understand what's the difference between _d_assocarrayliteralT() and _d_assocarrayliteralTX()? When are they called, and in which context? If I'm not mistaken (straight from my memory, didn't look it up again), _d

Re: Need help locating AA bug

2012-02-27 Thread Jonathan M Davis
On Monday, February 27, 2012 14:41:27 H. S. Teoh wrote: > I'm investigating issue 7512, and narrowed down the problem to a bug > somewhere in the code that handles AA literals. So I'm looking at > druntime's aaA.d. But I don't understand what's the difference between > _d_assocarrayliteralT() and _