dmd/compiler/test/runnable/test23514.d
Zachary Yedidia cd946d37c4
Fix issue 23514 - Incorrect compilation when adding a 64-bit constant to a link-time address (#14657)
* Fix issue 23514 - Incorrect compilation when adding a 64-bit constant to a link-time address

The current cast to int causes a loss of precision, which can result in
incorrect compilation.

* Add test23514.d

* Enable optimization in test

* Improve test case

* Use ulong instead of size_t

* Restrict test to 64-bit targets

* Re-enable test for 32-bit targets

* Disable test for win64 and add comment
2023-02-21 15:59:38 +01:00

13 lines
350 B
D

// DISABLED: win64
// https://issues.dlang.org/show_bug.cgi?id=23514
// Note: this test is disabled on Win64 because of an issue with the Windows
// MS-COFF backend causing it to fail.
enum ulong offset = 0xFFFF_FFFF_0000_0000UL;
void main()
{
ulong voffset = offset;
assert((cast(ulong)&main + voffset) == (cast(ulong)&main + offset));
}