This commit causes http://llvm.org/PR34309. Could you take a look?
On Mon, Aug 14, 2017 at 11:23 PM, Alexander Shaposhnikov via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: alexshap > Date: Mon Aug 14 14:23:08 2017 > New Revision: 310887 > > URL: http://llvm.org/viewvc/llvm-project?rev=310887&view=rev > Log: > [analyzer] Fix SimpleSValBuilder::simplifySVal > > This diff fixes a crash (triggered assert) on the newly added test case. > In the method Simplifier::VisitSymbolData we check the type of S and return > Loc/NonLoc accordingly. > > Differential revision: https://reviews.llvm.org/D36564 > > Modified: > cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp > cfe/trunk/test/Analysis/ptr-arith.cpp > > Modified: cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ > StaticAnalyzer/Core/SimpleSValBuilder.cpp?rev=310887&r1=310886&r2=310887& > view=diff > ============================================================ > ================== > --- cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (original) > +++ cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp Mon Aug 14 > 14:23:08 2017 > @@ -1016,7 +1016,8 @@ SVal SimpleSValBuilder::simplifySVal(Pro > SVB.getKnownValue(State, nonloc::SymbolVal(S))) > return Loc::isLocType(S->getType()) ? (SVal)SVB.makeIntLocVal(*I) > : (SVal)SVB.makeIntVal(*I); > - return nonloc::SymbolVal(S); > + return Loc::isLocType(S->getType()) ? (SVal)SVB.makeLoc(S) > + : nonloc::SymbolVal(S); > } > > // TODO: Support SymbolCast. Support IntSymExpr when/if we actually > > Modified: cfe/trunk/test/Analysis/ptr-arith.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > Analysis/ptr-arith.cpp?rev=310887&r1=310886&r2=310887&view=diff > ============================================================ > ================== > --- cfe/trunk/test/Analysis/ptr-arith.cpp (original) > +++ cfe/trunk/test/Analysis/ptr-arith.cpp Mon Aug 14 14:23:08 2017 > @@ -98,3 +98,10 @@ void checkMultiDimansionalArray() { > int a[5][5]; > *(*(a+1)+2) = 2; > } > + > +unsigned ptrSubtractionNoCrash(char *Begin, char *End) { > + auto N = End - Begin; > + if (Begin) > + return 0; > + return N; > +} > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits