D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13634 - Value range propogation applied incorrectly.
Summary: Value range propogation applied incorrectly.
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-18 17:49 UTC by gordon.freeman.sullied
Modified: 2024-12-13 18:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description gordon.freeman.sullied 2014-10-18 17:49:00 UTC
long a = 0;
long b = 9223372036854775807;
	
a = cast(double) b;
writeln(b);
writeln(a);


The results are:
b = 9223372036854775807
a = -9223372036854775808

This should not be possible.
Comment 1 gordon.freeman.sullied 2014-10-18 17:52:14 UTC
In the case of a large negative or positive value stored in a long, an intermediate double will not fully store it, therefore this should not be possible without more explicit means.
Comment 2 dlangBugzillaToGithub 2024-12-13 18:31:44 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17685

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB