digitalmars.D.bugs - dmd crash on pointer minus array
- h3r3tic (16/16) Mar 17 2005 This code shouldn't compile, it crashes the compiler:
- Thomas Kuehne (13/29) Mar 17 2005 -----BEGIN PGP SIGNED MESSAGE-----
This code shouldn't compile, it crashes the compiler: void main() { int[10] arr; int *p = &arr[5]; cast(uint)(p - arr); } When the code is reduced to: void main() { int[10] arr; int *p = &arr[5]; p - arr; } the compiler issues the correct error message "incompatible types for -". DMD.118; WinXP
Mar 17 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 h3r3tic schrieb am Fri, 18 Mar 2005 00:42:37 +0100:This code shouldn't compile, it crashes the compiler: void main() { int[10] arr; int *p = &arr[5]; cast(uint)(p - arr); }produces the expected error message and crashes (DMD 0.118; Linux)When the code is reduced to: void main() { int[10] arr; int *p = &arr[5]; p - arr; } the compiler issues the correct error message "incompatible types for -". DMD.118; WinXPAdded to DStress as http://dstress.kuehne.cn/nocompile/cast_23.d http://dstress.kuehne.cn/nocompile/cast_24.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCOmcH3w+/yD4P9tIRAjqlAJ4rQND+dxIimk9AJ55RmKP8WcnJkwCfdqyb VfahD0WwkX0sZXv4/MATZ28= =tNpI -----END PGP SIGNATURE-----
Mar 17 2005