January 07, 2007 [Issue 813] New: regression: optimizer & scope | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=813 Summary: regression: optimizer & scope Product: D Version: 1.00 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P3 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: thomas-dloop@kuehne.cn http://dstress.kuehne.cn/run/s/scope_16_A.d # void main(){ # scope x = 1.2; # static assert(is(typeof(x) == double)); # # x++; # if(x != 2.2){ # assert(0); # } # } fails only if compiled with "-O" -- |
February 02, 2007 [Issue 813] regression: optimizer & scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=813 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #1 from bugzilla@digitalmars.com 2007-02-02 03:31 ------- The problem here is that 2.2 is not representable exactly. Constant folding happens in different ways depending on if the optimizer is run or not, resulting in slightly different answers due to roundoff error. Generally speaking, an algorithm that depends on this is always going to have trouble. To make the example work, use a constant that is exactly representable, like 1.25 and 2.25. Not a compiler bug. -- |
Copyright © 1999-2021 by the D Language Foundation