New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler emits Warning 59 on array assignment #7616
Comments
Comment author: @Octachron Interestingly, the warning is not triggered with 4.05.0+flambda but rears its head again with trunk. |
Comment author: @xclerc The problem is related to the definition of (Note that the function is used only to trigger the warning.) However, it would entail a small regression, as examplified by some of the tests present It thus depends on whether we prefer false positives or false negative. One problem with |
Comment author: @Octachron False positives sound more benign than false negatives. Nevertheless, the flambda part of the manual currently only warns about false negatives for this warning. I think it would help users to at least clarify this point in the manual, and add a reference inside the warning message towards this extended explanation. It is also a bit unfortunate that this warning cannot be disabled locally with warning attributes. |
Comment author: @xclerc Indeed. Moreover, the manual proves me wrong: there is a way to let filter_map f a = [1] https://github.com/c-cube/ocaml-containers/blob/master/src/core/CCArray.ml |
Comment author: @xclerc Tested - the PR fixes the problem on this instance. |
Comment author: @damiendoligez Fixed by #1339 |
Original bug ID: 7616
Reporter: freyr
Status: resolved (set by @damiendoligez on 2017-10-02T12:16:42Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: linux x86_64
OS: fedora 26
OS Version: 4.12.8-300.fc26
Version: 4.04.2
Category: middle end (typedtree to clambda)
Monitored by: @gasche @hcarty
Bug description
Compiler emits warning 59 being emitted when I assign array to ref.
x := [||];
works fine, butx := CCArray.filter_map filter !x;
(CCArray.filter_map from containers package [1]) emits warning 59 (A potential assignment to a non-mutable value was detected)
Steps to reproduce
compiler: 4.04.2 + flambda
set -O3 flag
compile a trivial program containing
x := CCArray.filter_map filter !x;
Additional information
Trivial example with the corresponded Makefile is attached
File attachments
The text was updated successfully, but these errors were encountered: