]> granicus.if.org Git - clang/commit
[analyzer] Avoid unnecessary enum range check on LValueToRValue casts
authorKristof Umann <kristof.umann@ericsson.com>
Fri, 23 Aug 2019 14:21:13 +0000 (14:21 +0000)
committerKristof Umann <kristof.umann@ericsson.com>
Fri, 23 Aug 2019 14:21:13 +0000 (14:21 +0000)
commit061e7a9646c7f3463d588c271e6a8680a3d30db3
tree853b885561f23a96bd0580c684b401dc0ca22c48
parenta0378a8d1f737c588400ffdab396251c27bc481e
[analyzer] Avoid unnecessary enum range check on LValueToRValue casts

Summary: EnumCastOutOfRangeChecker should not perform enum range checks on LValueToRValue casts, since this type of cast does not actually change the underlying type.   Performing the unnecessary check actually triggered an assertion failure deeper in EnumCastOutOfRange for certain input (which is captured in the accompanying test code).

Reviewers: #clang, Szelethus, gamesh411, NoQ

Reviewed By: Szelethus, gamesh411, NoQ

Subscribers: NoQ, gamesh411, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, bjope, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66014

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369760 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
test/Analysis/enum-cast-out-of-range.c [new file with mode: 0644]
test/Analysis/enum-cast-out-of-range.cpp