January 06, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=802

           Summary: ABI/API issues in phobos/internal/aaA.d
           Product: D
           Version: 1.00
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


This isn't a bug report but rather an issues report about potential ABI/API
issues found in phobos/internal/aaA.d. This includes current differences
between
DMD-1.00 and GDC-0.21 as well as portability issues.

=== prime_list ===
prime_list's type is "uint[]" but the literal is "ulong[]".
Conditional compilation with "size_t[]" seems more portable
and wouldn't introduce "ulong" penalties on 32bit systems.

=== ArrayRet_t ==
> This is the type of the return value for dynamic arrays.
> It should be a type that is returned in registers.
> Although DMD will return types of Array in registers,
> gcc will not, so we instead use a 'long'.
>
>  alias long ArrayRet_t;

This is 32bit specific. Please use at least  "alias intmax_t ArrayRet_t" or better fix GDC.

=== Array ===
Array is defined in five locations:
gc/gc.d:418:struct Array
aaA.d:56:struct Array
adi.d:41:struct Array
qsort.d:34:struct Array
qsort2.d:17:struct Array

=== _aaGet ===
DMD: void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, ...)
GDC: void *_aaGetp(AA* aa, TypeInfo keyti, size_t valuesize, void *pkey)

DMD uses calling convention and architecture dependent code to get pkey
internal/aaA.d:244 auto pkey = cast(void *)(&valuesize + 1);

=== _aaGetRvalue ===
DMD: void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, ...)
GDC: void *_aaGetRvaluep(AA aa, TypeInfo keyti, size_t valuesize, void *pkey)

DMD uses calling convention and architecture dependent code to get pkey
internal/aaA.d:306 auto pkey = cast(void *)(&valuesize + 1);

=== _aaIn ===
DMD: void* _aaIn(AA aa, TypeInfo keyti, ...)
GDC: void* _aaInp(AA aa, TypeInfo keyti, void *pkey)

DMD uses calling convention and architecture dependent code to get pkey
internal/aaA.d:352 auto pkey = cast(void *)(&valuesize + 1);

=== _aaDel ===
DMD: void _aaDel(AA aa, TypeInfo keyti, ...)
GDC: void _aaDelp(AA aa, TypeInfo keyti, void *pkey)

DMD uses calling convention and architecture dependent code to get pkey
internal/aaA.d:395 auto pkey = cast(void *)(&valuesize + 1);

=== _aaValues ===
DMD: ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize)
GDC: Array _aaValues(AA aa, size_t keysize, size_t valuesize)

=== _aaRehash ==
DMD: void* _aaRehash(AA* paa, TypeInfo keyti)
GDC: AA _aaRehash(AA* paa, TypeInfo keyti)

=== _aaKeys ===
DMD: ArrayRet_t _aaKeys(AA aa, size_t keysize)
GDC: Array _aaKeys(AA aa, size_t keysize)

=== dg_t / dg2_t ===
internal/aaA.d:637 extern (D) typedef int delegate(void *) dg_t;
internal/aaA.d:690 extern (D) typedef int delegate(void *, void *) dg2_t;

Is "int" instead of "size_t" or "bool" really the proper return type?

=== dg_t ===
dg_t is defined in three locations:

aaA.d:637:extern (D) typedef int delegate(void *) dg_t;
aApply.d:42:extern (D) typedef int delegate(void *) dg_t;
aApplyR.d:42:extern (D) typedef int delegate(void *) dg_t;

=== dg2_t ==
dg2_t is defined in three locations:

aaA.d:690:extern (D) typedef int delegate(void *, void *) dg2_t;
aApply.d:219:extern (D) typedef int delegate(void *, void *) dg2_t;
aApplyR.d:506:extern (D) typedef int delegate(void *, void *) dg2_t;


--