Mercurial > projects > ldc
changeset 1120:0d38fa5a0b46
Another "pointers are 32 bits" issue in the frontend. long/ulong constants cast
to pointers were truncated to 32-bit values.
Closes #234.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 15 Mar 2009 15:58:38 +0100 |
parents | 2cd6199488f6 |
children | 3d46f7ee466e |
files | dmd/expression.c |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/expression.c Sat Mar 14 22:44:52 2009 +0100 +++ b/dmd/expression.c Sun Mar 15 15:58:38 2009 +0100 @@ -1348,11 +1348,17 @@ case Twchar: case Tuns16: value = (d_uns16) value; break; case Tint32: value = (d_int32) value; break; - case Tpointer: case Tdchar: case Tuns32: value = (d_uns32) value; break; case Tint64: value = (d_int64) value; break; case Tuns64: value = (d_uns64) value; break; + case Tpointer: + // FIXME: Other pointer widths than 32 and 64? + if (PTRSIZE == 4) + value = (d_uns32) value; + else + value = (d_uns64) value; + break; case Tenum: { @@ -1512,6 +1518,7 @@ break; case Tuns64: + L4: buf->printf("%juLU", v); break; @@ -1524,7 +1531,11 @@ buf->writestring("cast("); buf->writestring(t->toChars()); buf->writeByte(')'); - goto L3; + // FIXME: Other pointer widths than 32 and 64? + if (PTRSIZE == 4) + goto L3; + else + goto L4; default: /* This can happen if errors, such as