Summary: | -Wconversion generates a false warning for modulo expression when the modulus has smaller type | ||
---|---|---|---|
Product: | gcc | Reporter: | John Simon <gcc> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | NEW --- | ||
Severity: | normal | CC: | xry111 |
Priority: | P3 | Keywords: | diagnostic |
Version: | 9.2.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2020-01-29 00:00:00 |
Description
John Simon
2019-10-25 04:50:37 UTC
No i think there is one case where what you said is incorrect. When both are INT_MIN. *** Bug 92219 has been marked as a duplicate of this bug. *** (In reply to Andrew Pinski from comment #1) > No i think there is one case where what you said is incorrect. When both are > INT_MIN. In this case the result will be 0. Confirmed. Unfortunately the value range info is not available in the frontend :(. (In reply to Xi Ruoyao from comment #5) > Unfortunately the value range info is not available in the frontend :(. Here "value range info" means the info from the VRP pass. For this case we can specially check MOD_EXPR, but doing so won't help with the general cases like "return a % b / 2;". |