forked from chapel-lang/chapel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warnings for some numeric implicit conversions (chapel-lang#24529)
This PR adds an opt-in warning for implicit numeric conversion from an int/uint of size < 64 bits to a real/complex of non-default size. This warning is meant to address issue chapel-lang#24496. If we can improve this warning to be more focused, we might turn it on-by-default in the future. This warning can be activated with `--warn-small-integral-to-float`. It also adds an unstable warning for such cases with 8- or 16- bit `int`/`uint` implicitly converting to `real(32)`, since something like `sqrt(myInt16)` might well result in a different type after we add `real(16)`. This unstable warning will appear if compiling with `--warn-unstable`. In addition, this PR adds a number of other off-by-default warnings to address chapel-lang#20687. These will only warn for user code (rather than standard modules), just to avoid a large amount of useless information coming from them. However, that approach has the drawback that an implicit conversion could occur in an internal module and propagate to user code. However, I think these warnings will still be useful to users even with that caveat. The new flags are: * `--[no-]warn-int-to-uint` to warn for int->uint * `--[no-]warn-small-integral-to-float` to warn for int/uint 8/16/32 -> real(32)/complex(64) * `--[no-]warn-integral-to-float` to warn for any int/uint -> real/complex * `--[no-]warn-float-to-float` to warn for real(32) -> real(64) and similar for imag/complex * `--[no-]warn-integral-to-integral` to warn for int/uint to larger int/uint * `--[no-]warn-implicit-numeric-conversions` to activate all of the above * `--[no-]warn-param-implicit-numeric-conversions` to make the above more sensitive to param values Reviewed by @dlongnecke-cray and @bradcray - thanks! - [x] comm=none testing
- Loading branch information
Showing
40 changed files
with
529 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.