Mercurial > projects > dstress
changeset 1505:b0e88ac8bc7e
[Issue 1145] bad codegen with ulong+float
Carlos Santander B. <csantander619@gmail.com>
2007-04-14
http://d.puremagic.com/issues/show_bug.cgi?id=1145
author | thomask |
---|---|
date | Mon, 23 Apr 2007 18:02:31 +0000 |
parents | 805b24f2e33f |
children | b3b959a6ff7b |
files | compile/o/odd_bug_16_A.d run/o/odd_bug_16_B.d |
diffstat | 2 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/o/odd_bug_16_A.d Mon Apr 23 18:02:31 2007 +0000 @@ -0,0 +1,16 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Carlos Santander B. <csantander619@gmail.com> +// @date@ 2007-04-14 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1145 +// @desc@ [Issue 1145] bad codegen with ulong+float + +module dstress.compile.o.odd_bug_16_A; + +ulong foo (){ + return cast(ulong) (1176576512UL + -2.0f); +} + +static assert(foo()==1176576510);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/odd_bug_16_B.d Mon Apr 23 18:02:31 2007 +0000 @@ -0,0 +1,21 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Carlos Santander B. <csantander619@gmail.com> +// @date@ 2007-04-14 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1145 +// @desc@ [Issue 1145] bad codegen with ulong+float + +module dstress.run.o.odd_bug_16_B; + +ulong foo (){ + return cast(ulong) (1176576512UL + -2.0f); +} + +int main(){ + if(foo() != 1176576510){ + assert(0); + } + return 0; +}