www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD 0.107 crashed

reply "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
I finally started to mess around with D and managed to crash the latest dmd 
with this test program:

struct bittest_T(int C)
{
 bit b[C];
};
void main()
{
 for (int t=0; t<32; t++)
  printf("sizeof bittest_T(%i) %i\n", t, bittest_T!(t).sizeof );
}

DMD prints this compile error (which makes sense):

C:\UTIL\d\fart.d(33): template instance fart.bittest_T!(t) cannot use local 
't'
as template parameter

..and crashes with an access violation exception.
I ran DMD.EXE from MSDEV and it breaks at 0040B6D1:

0040B6CA 90                   nop
0040B6CB 90                   nop
(function entry point?)
0040B6CC 53                   push        ebx
0040B6CD 31 C0                xor         eax,eax
0040B6CF 89 CB                mov         ebx,ecx
0040B6D1 88 00                mov         byte ptr [eax],al

Pretty obvious: EAX is set to 0, and then used in a look-up?
Memory ECX points to:

003C4438  C4 46 4A 00 B4 CD 39 00 03 00 00 00 1B 00 00 00  FJ.9.........
003C4448  60 40 39 00 1C 00 00 00 58 3B 39 00 00 00 00 00  ` 9.....X;9.....
003C4458  7C 44 3C 00 00 00 00 00 00 00 00 00 00 00 00 00  |D<.............

Hope this helps,

Lionello.

-- Get the CACert root certificate (and a personal one) at 
http://cacert.org/ 
Nov 29 2004
parent reply "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
Same crash with this program:

void main()
{
 for (int t=0; t<33; t++)
  printf("sizeof bittest_T(0) %i\n", (bit[t]).sizeof );
}

(Guess what I'm trying to do :-S )

Memory ECX points to:

003C3EE0  C4 46 4A 00 B4 CD 39 00 04 00 00 00 1B 00 00 00  FJ.9.........
003C3EF0  60 40 39 00 1C 00 00 00 D0 3A 39 00 00 00 00 00  ` 9.....?:9.....
003C3F00  24 3F 3C 00 00 00 00 00 00 00 00 00 00 00 00 00  $?<.............

L. 
Nov 29 2004
next sibling parent reply "Simon Buchan" <currently no.where> writes:
On Tue, 30 Nov 2004 09:23:26 +0200, Lionello Lunesu  
<lionello.lunesu crystalinter.remove.com> wrote:

 Same crash with this program:

 void main()
 {
  for (int t=0; t<33; t++)
   printf("sizeof bittest_T(0) %i\n", (bit[t]).sizeof );
 }

D should complain with: Integer constant expression expected instead of t and does for me. -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" "Clearly, if I were one of that Predator hunting team, I would file a complaint with my local member asking why such an unsafe environment should be allowed to continue, tradition or not." - http://www.sydneyanglicans.net/culture/watching/alien_vs_predator/
Nov 30 2004
parent reply "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
I just tested again, it really crashes.

# void main()
# {
#  for (int t=0; t<33; t++)
#   printf("sizeof bittest_T(0) %i\n", (bit[t]).sizeof );
# }

DMD 0.107 doesn't say a thing; crashes immediately. Doesn't print the 
link-line either so I guess it's the compiler.

Running WindowsXP with SP2:

Microsoft Windows XP [Version 5.1.2600]
Digital Mars D Compiler v0.107
OPTLINK (R) for Win32  Release 7.50B1

L.

(I've even tried running dmd from cmd.exe, 4nt.exe 5.00u and msdev6: no 
difference)
Nov 30 2004
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Added to DStress as
http://svn.kuehne.cn/dstress/nocompile/array_initialization_04.d

Thomas

PS: I can't reproduce this under Linux.

Lionello Lunesu schrieb am Tue, 30 Nov 2004 16:20:44 +0200:
 I just tested again, it really crashes.

 # void main()
 # {
 #  for (int t=0; t<33; t++)
 #   printf("sizeof bittest_T(0) %i\n", (bit[t]).sizeof );
 # }

 DMD 0.107 doesn't say a thing; crashes immediately. Doesn't print the 
 link-line either so I guess it's the compiler.

 Running WindowsXP with SP2:

 Microsoft Windows XP [Version 5.1.2600]
 Digital Mars D Compiler v0.107
 OPTLINK (R) for Win32  Release 7.50B1

 L.

 (I've even tried running dmd from cmd.exe, 4nt.exe 5.00u and msdev6: no 
 difference)

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.9 (GNU/Linux) iD8DBQFBrXwg3w+/yD4P9tIRAqtsAJ9J0MDaCdhErUc73xdURyfBUZCqxgCfZFtb nY6rdW358w97XSQUTL+jz+4= =VqLd -----END PGP SIGNATURE-----
Dec 01 2004
prev sibling next sibling parent "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
(XP created this file. Is this useful?) 
Nov 30 2004
prev sibling parent "Lionello Lunesu" <lionello.lunesu crystalinter.remove.com> writes:
[D:\] dmd -v crash.d
parse     crash
semantic  crash
semantic2 crash
semantic3 crash 
Nov 30 2004