strange _sort_ of bug
David Medlock
noone at nowhere.com
Thu Sep 21 07:00:17 PDT 2006
I am getting an Access Violation using the array built-in sort.
My structure looks quite harmless:
class EdgeInfo
{
int from, to;
float cost = 0;
public int opCmp( Object o )
{
EdgeInfo e = cast(EdgeInfo)o;
float other = e.cost;
if ( cost < other ) return -1;
if ( equal( other , cost ) ) return 0; else return 1;
}
}
if I use an external sort the problem doesnt occur.
If I change it to a class(and change the opCmp) it still happens.
Moving this to a test case file makes it vanish, and its a fairly
lengthy routine (3d Mesh simplification).
The error occurs here:
Thread stopped.
MVIEW!_D6object8TypeInfo4swapFPvPvZv+0x1a
TypeInfo.swap() ??
stop occurs at 0x0041bf86 in the following:
_D6object8TypeInfo4swapFPvPvZv:
0x0041bf6c 50 push eax
0x0041bf6d 8b08 mov ecx,dword ptr [eax]
0x0041bf6f 53 push ebx
0x0041bf70 31db xor ebx,ebx
0x0041bf72 55 push ebp
0x0041bf73 56 push esi
0x0041bf74 8b742414 mov esi,dword ptr [esp+14]
0x0041bf78 57 push edi
0x0041bf79 8b7c241c mov edi,dword ptr [esp+1c]
0x0041bf7d ff5124 call dword ptr [ecx+24]
0x0041bf80 89c5 mov ebp,eax
0x0041bf82 85c0 test eax,eax
0x0041bf84 7411 je
_D6object8TypeInfo4swapFPvPvZv+0000002b (0041bf97)
0x0041bf86 8a143b mov dl,byte ptr [edi+ebx]
0x0041bf89 8a0c33 mov cl,byte ptr [esi+ebx]
0x0041bf8c 880c3b mov byte ptr [edi+ebx],cl
0x0041bf8f 881433 mov byte ptr [esi+ebx],dl
0x0041bf92 43 inc ebx
0x0041bf93 39eb cmp ebx,ebp
0x0041bf95 72ef jb
_D6object8TypeInfo4swapFPvPvZv+0000001a (0041bf86)
0x0041bf97 5f pop edi
0x0041bf98 5e pop esi
0x0041bf99 5d pop ebp
0x0041bf9a 5b pop ebx
0x0041bf9b 58 pop eax
0x0041bf9c c20800 retn 0008
0x0041bf9f cc int 3
Any tips would be helpful.
-DavidM
More information about the Digitalmars-d-bugs
mailing list