[Bug c/111056] Missing -Wsign-compare warning with enum values

2023-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111056 --- Comment #4 from Andrew Pinski --- (In reply to Alex Henrie from comment #3) > I imagine that it would be difficult to change GCC's behavior to match > Clang's in this case. Except GCC does not warn at -O1 and above (there are a few other b

[Bug c/111056] Missing -Wsign-compare warning with enum values

2023-08-17 Thread alexhenrie24 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111056 --- Comment #3 from Alex Henrie --- By the way, thanks for pointing out that using constexpr suppresses the warning on GCC. Although Clang does not support constexpr in C yet, it is interesting that Clang is smart enough to not warn about a plai

[Bug c/111056] Missing -Wsign-compare warning with enum values

2023-08-17 Thread alexhenrie24 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111056 Alex Henrie changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/111056] Missing -Wsign-compare warning with enum values

2023-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111056 --- Comment #1 from Andrew Pinski --- We don't warn for the same reason as we don't warn for `constexpr` because the value is known at compile time. That is: ``` #include int main() { signed int a = 1; enum : signed int { b = 1 }d = b;