https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #6 from Gábor Buella ---
(In reply to Jonathan Wakely from comment #4)
> I can't reproduce this with GCC 9, only 8.
$ cat code.cc
enum some_enum { x = 1000 };
void sink(some_enum);
void func()
{
for (int i = 0; i < 3; ++i)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #5 from Richard Earnshaw ---
I'm seeing it on AArch64 for master. Adding an enum value with an initializer
of -1 causes the problem to go away. So it looks like the 'unsigned'
conversion is happening too soon.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #4 from Jonathan Wakely ---
I can't reproduce this with GCC 9, only 8.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #3 from Gábor Buella ---
In case anyone would still get confused about the what values get casted to
enum, here is another way to write that example:
enum some_enum { x0, x1, x2, x3, x4, x5, x6, x7,
x8, x9,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #2 from Gábor Buella ---
(In reply to Andrew Pinski from comment #1)
> -fstrict-enums
> Allow the compiler to optimize using the assumption that a value of
> enumerated type can only be one of the values of the enumeration (as defined
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93674
--- Comment #1 from Andrew Pinski ---
-fstrict-enums
Allow the compiler to optimize using the assumption that a value of enumerated
type can only be one of the values of the enumeration (as defined in the C++
standard; basically, a value that can