This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/43680] G++ is too aggressive in optimizing away bounds checking with enums



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]