www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12699] New: Possibly wrong code in object_.d


          Issue ID: 12699
           Summary: Possibly wrong code in object_.d
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

TypeInfo_AssociativeArray is a TypeInfo class and its 'getHash' method is
implemented as:

    override hash_t getHash(in void* p) nothrow  trusted const
        return _aaGetHash(cast(void*)p, this);

But _aaGetHash expects an 'AA* aa' as the first parameter, not a TypeInfo. As a
result _aaGetHash will sometimes crash while attempting to access
'aa.impl.buckets', since at that offset it's accessing whatever happens to lay
at that address in a TypeInfo class.

This change was introduced in commit 87e5f64. Unless I'm misunderstanding
something I don't think the above is right.

May 04 2014