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 sanitizer/81598] -fsanitize=enum does not detect range violation


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81598

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The extra instrumention should be on NOP_EXPR/CONVERT_EXPR (dunno about
VIEW_CONVERT_EXPR) from some type to enum type if the from type isn't the same
enum type or some type with equal min/max values.  But given that we consider
such conversions useless:
  /* If both the inner and outer types are integral types, then the
     conversion is not necessary if they have the same mode and
     signedness and precision, and both or neither are boolean.  */
we'd need to instrument that early (either during genericization, or
gimplification at latest).  It could be done by turning the check into some ifn
and lowering it later (sanopt) of course.

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