[Issue 22277] removing strongly pure function calls is an incorrect optimization

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 28 14:35:02 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22277

--- Comment #11 from Dennis <dkorpel at live.nl> ---
(In reply to Ate Eskola from comment #10)
> I think the compiler is allowed to elide a `free` call implemented like
> that.

Agreed, I used a `debug` statement for demonstration purposes based on the
knowledge that the compiler doesn't inspect the function body in this case.

A proper test case would hide the implementation:
```
void free(immutable void* mem) pure nothrow;
```

And then compile the implementation separately.

--


More information about the Digitalmars-d-bugs mailing list