Bug 17943 – Wrong pointer arithmetic optimization

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2017-10-27T08:24:00Z
Last change time
2017-11-02T07:57:28Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Илья Ярошенко

Comments

Comment #0 by ilyayaroshenko — 2017-10-27T08:24:00Z
unittest { int[32] data; auto p1 = data.ptr + 0; auto p2 = data.ptr + 3; assert(p2 - p1 == 3); } dmd -release -unittest -main -run test.d pass dmd -O -release -unittest -main -run test.d fails Tested with DMD 2.076 - 2.077, Linux, OSX.
Comment #1 by ag0aep6g — 2017-10-27T15:29:40Z
Works for me when I use dmd 2.076.1 from dlang.org. But it fails when I use a home-grown 2.076.1 (built with the one from dlang.org).
Comment #2 by github-bugzilla — 2017-11-01T11:34:25Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b8a263d2aa7a2091d95dc6f57fd06f1315b5c9fa Fix issue 17943 - Wrong pointer arithmetic optimization store result as llong. https://github.com/dlang/dmd/commit/a244ac72197211d94be965ce09a5f84be2ac09e4 Merge pull request #7269 from yshui/17943 Fix issue 17943 - Wrong pointer arithmetic optimization merged-on-behalf-of: Martin Nowak <[email protected]>
Comment #3 by github-bugzilla — 2017-11-02T07:57:28Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b8a263d2aa7a2091d95dc6f57fd06f1315b5c9fa Fix issue 17943 - Wrong pointer arithmetic optimization https://github.com/dlang/dmd/commit/a244ac72197211d94be965ce09a5f84be2ac09e4 Merge pull request #7269 from yshui/17943