[Bug c/83433] Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread yaghmour.shafik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

--- Comment #3 from Shafik Yaghmour  ---
I still think it is awkwardly worded but your second point is valid about it
only warning on comparisons. 

Please, feel free to close.

[Bug c/83433] Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

--- Comment #2 from Jonathan Wakely  ---
Specifically, it says

 "warn about other cases where a comparison is simplified to a constant"
   

Calling abs(INT_MIN) is not a comparison.

[Bug c/83433] Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

--- Comment #1 from Jonathan Wakely  ---
The docs don't indicate that to me. The option warns about checking if the
result of abs(x) is non-negative, which is true except for the undefined case
of abs(INT_MIN), it doesn't warn about the call to abs(INT_MIN) itself.

Also note that your wandbox example doesn't enable -fstrict-overflow, so the
warning option is ignored. "This option is only active when -fstrict-overflow
is active." (But there's still no warning with -fstrict-overflow).