Bug 12619 – Invalid warning for unused return value of debug memcpy

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-22T22:24:00Z
Last change time
2014-05-02T22:22:36Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-04-22T22:24:46Z
Technically this is a regression, but it's a minor one. Issue found by CyberShadow: void main() pure { import core.stdc.string: memcpy; ubyte[10] a, b; debug memcpy(a.ptr, b.ptr, 5); } DMD 2.066alpha gives: test2.d(4,17): Warning: Call to function core.stdc.string.memcpy without side effects discards return value of type void*, prepend a cast(void) if intentional memcpy is weakly pure, so I think you should not get that warning, that I think should be only for strongly pure functions.
Comment #1 by k.hara.pg — 2014-04-23T12:00:09Z
The regression has caused by the implementation of issue 3882. https://github.com/D-Programming-Language/dmd/pull/3491
Comment #2 by github-bugzilla — 2014-05-02T22:22:34Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/384e23ae4b374fddbc14787d19cdab8db482b731 fix Issue 12619 - Invalid warning for unused return value of debug memcpy https://github.com/D-Programming-Language/dmd/commit/19a9e4fe64b45ad9f97b3c05eed8c8b81b220c33 Merge pull request #3491 from 9rnsr/fix12619 [REG2.066a] Issue 12619 - Invalid warning for unused return value of debug memcpy