March 17, 2005 dmd crash on pointer minus array | ||||
|---|---|---|---|---|
| ||||
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
| ||||
March 18, 2005 Re: dmd crash on pointer minus array | ||||
|---|---|---|---|---|
| ||||
Posted in reply to h3r3tic | -----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; WinXP Added 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----- | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply