This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/43680] G++ is too aggressive in optimizing away bounds checking with enums
- From: "jason at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Apr 2010 15:57:32 -0000
- Subject: [Bug c++/43680] G++ is too aggressive in optimizing away bounds checking with enums
- References: <bug-43680-114@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from jason at gcc dot gnu dot org 2010-04-08 15:57 -------
@7: But -Wconversion only warns if it knows the constant value, it doesn't warn
about converting from an arbitrary int variable such as (importantly) a loop
counter.
@5: It seems appropriate to me for VRP to optimize based on TYPE_MIN/MAX_VALUE,
the problem is that the front end is lying; either we need to apply a mask on
conversion to the enum, or we should set TYPE_MIN/MAX_VALUE to the appropriate
values for the mode. My preference is for the latter, and it sounds like Ada
made the same choice.
The debugging backends don't seem to care about TYPE_MIN/MAX_VALUE for enums.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680