https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58192
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- When I compile: #ifdef CHAR typedef unsigned char Foo; #else enum class Foo : unsigned char { FOO }; #endif unsigned int v1, v2; __attribute__((noinline, noclone)) static void foo (Foo a) { v1 = (unsigned int) a; } __attribute__((noinline, noclone)) void bar (Foo a) { v2 = (unsigned int) a; } void baz (unsigned int a) { foo ((Foo) a); bar ((Foo) a); } with -DCHAR vs. -UCHAR, there is a difference visible already in *.original dump: <<cleanup_point <<< Unknown tree: expr_stmt - foo ((int) (Foo) a) >>>>>; + foo ((Foo) a) >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt - bar ((int) (Foo) a) >>>>>; + bar ((Foo) a) >>>>>; i.e. there is explicit zero-extension for integral types smaller than int in the IL (i.e. for the -DCHAR) case, but nothing like that for the enum class with underlying type smaller than int. And presumably the middle-end and backends rely on this.