← Back to index
|
Original Bugzilla link
Bug 16530 – -O -cov interaction leads to wrong codegen
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-09-23T17:33:00Z
Last change time
2016-11-04T09:05:11Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
andrei
Comments
Comment #0
by andrei — 2016-09-23T17:33:05Z
Code: double entropy(double[] probs) { double result = 0; // BUG: remove the "ref" below to expose codegen bug in dmd foreach (p; probs) { if (!p) continue; import std.math : log2; result -= p * log2(p); } return result; } void main() { import std.stdio; writeln(entropy([1.0, 0, 0])); } To repro, build with -O -cov. It will print -nan. Should print 0.
Comment #1
by bugzilla — 2016-09-24T12:30:02Z
https://github.com/dlang/dmd/pull/6151
Comment #2
by github-bugzilla — 2016-09-24T23:09:00Z
Commits pushed to master at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/ad382b87d3f0a9f8992fe836165e26a68724ad77
fix Issue 16530 - -O -cov interaction leads to wrong codegen
https://github.com/dlang/dmd/commit/a46db4fae2a4fee21bbd67c6be5859054a2fa4c7
Merge pull request #6151 from WalterBright/fix16530 [critical] fix Issue 16530 - -O -cov interaction leads to wrong codegen
Comment #3
by github-bugzilla — 2016-10-01T11:48:48Z
Commits pushed to stable at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/ad382b87d3f0a9f8992fe836165e26a68724ad77
fix Issue 16530 - -O -cov interaction leads to wrong codegen
https://github.com/dlang/dmd/commit/a46db4fae2a4fee21bbd67c6be5859054a2fa4c7
Merge pull request #6151 from WalterBright/fix16530
Comment #4
by github-bugzilla — 2016-11-04T09:05:11Z
Commits pushed to newCTFE at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/ad382b87d3f0a9f8992fe836165e26a68724ad77
fix Issue 16530 - -O -cov interaction leads to wrong codegen
https://github.com/dlang/dmd/commit/a46db4fae2a4fee21bbd67c6be5859054a2fa4c7
Merge pull request #6151 from WalterBright/fix16530