This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/50189] [4.5/4.6 Regression] Wrong code error in -O2 [-fstrict-enums] compile, target independent
- From: "pkoning at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Oct 2011 14:04:30 +0000
- Subject: [Bug middle-end/50189] [4.5/4.6 Regression] Wrong code error in -O2 [-fstrict-enums] compile, target independent
- Auto-submitted: auto-generated
- References: <bug-50189-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50189
--- Comment #12 from Paul Koning <pkoning at gcc dot gnu.org> 2011-10-12 14:04:30 UTC ---
You said "GCC treats types compatible when they have the same precision".
That's where the problem lies, because enums with -fstrict-enums have their
precision set to just enough bits to hold the range of values, rather than the
precision of the base integer type. So in the test case in question, the
variable's precision is 32 bits while the right hand side precision is 2 bits.