Skip to content

Commit 4f4b97c

Browse files
committed
Minor fix in GCChecker. Args for jl_type_error are unpinned.
1 parent b1f61bb commit 4f4b97c

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/clangsa/GCChecker.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ void GCChecker::checkBeginFunction(CheckerContext &C) const {
833833
const auto *FD = dyn_cast<FunctionDecl>(LCtx->getDecl());
834834
if (!FD)
835835
return;
836+
logWithDump("checkBeginFunction", FD);
836837
ProgramStateRef State = C.getState();
837838
bool Change = false;
838839
if (C.inTopFrame()) {
@@ -880,6 +881,7 @@ void GCChecker::checkBeginFunction(CheckerContext &C) const {
880881

881882
void GCChecker::checkEndFunction(const clang::ReturnStmt *RS,
882883
CheckerContext &C) const {
884+
log("checkEndFunction");
883885
ProgramStateRef State = C.getState();
884886

885887
if (RS && gcEnabledHere(C) && RS->getRetValue() && isGCTracked(RS->getRetValue())) {
@@ -1153,7 +1155,7 @@ bool GCChecker::processArgumentRooting(const CallEvent &Call, CheckerContext &C,
11531155
const ValueState *CurrentVState = State->get<GCValueMap>(RootedSymbol);
11541156
ValueState NewVState = *OldVState;
11551157
// If the old state is pinned, the new state is not pinned.
1156-
if (OldVState->isPinned() && ((CurrentVState && CurrentVState->isPinnedByAnyway()) || !CurrentVState)) {
1158+
if (OldVState->isPinned() && ((CurrentVState && !CurrentVState->isPinnedByAnyway()) || !CurrentVState)) {
11571159
NewVState = ValueState::getNotPinned(*OldVState);
11581160
}
11591161
logWithDump("- Rooted set to", NewVState);
@@ -1245,8 +1247,11 @@ bool GCChecker::processAllocationOfResult(const CallEvent &Call,
12451247
void GCChecker::checkPostCall(const CallEvent &Call, CheckerContext &C) const {
12461248
logWithDump("checkPostCall", Call);
12471249
ProgramStateRef State = C.getState();
1250+
log("- processArgmentRooting");
12481251
bool didChange = processArgumentRooting(Call, C, State);
1252+
log("- processPotentialsafepoint");
12491253
didChange |= processPotentialSafepoint(Call, C, State);
1254+
log("- processAllocationOfResult");
12501255
didChange |= processAllocationOfResult(Call, C, State);
12511256
if (didChange)
12521257
C.addTransition(State);
@@ -1255,6 +1260,7 @@ void GCChecker::checkPostCall(const CallEvent &Call, CheckerContext &C) const {
12551260
// Implicitly root values that were casted to globally rooted values
12561261
void GCChecker::checkPostStmt(const CStyleCastExpr *CE,
12571262
CheckerContext &C) const {
1263+
logWithDump("checkpostStmt(CStyleCastExpr)", CE);
12581264
if (!isGloballyRootedType(CE->getTypeAsWritten()))
12591265
return;
12601266
SymbolRef Sym = C.getSVal(CE).getAsSymbol();
@@ -1481,6 +1487,7 @@ void GCChecker::checkPostStmt(const MemberExpr *ME, CheckerContext &C) const {
14811487

14821488
void GCChecker::checkPostStmt(const UnaryOperator *UO,
14831489
CheckerContext &C) const {
1490+
logWithDump("checkPostStmt(UnaryOperator)", UO);
14841491
if (UO->getOpcode() == UO_Deref) {
14851492
checkDerivingExpr(UO, UO->getSubExpr(), true, C);
14861493
}
@@ -1994,6 +2001,7 @@ bool GCChecker::rootRegionIfGlobal(const MemRegion *R, ProgramStateRef &State,
19942001

19952002
void GCChecker::checkLocation(SVal SLoc, bool IsLoad, const Stmt *S,
19962003
CheckerContext &C) const {
2004+
logWithDump("checkLocation", SLoc);
19972005
ProgramStateRef State = C.getState();
19982006
bool DidChange = false;
19992007
const RootState *RS = nullptr;

src/julia.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,12 +1871,12 @@ JL_DLLEXPORT void JL_NORETURN jl_exceptionf(jl_datatype_t *ty,
18711871
JL_DLLEXPORT void JL_NORETURN jl_too_few_args(const char *fname, int min);
18721872
JL_DLLEXPORT void JL_NORETURN jl_too_many_args(const char *fname, int max);
18731873
JL_DLLEXPORT void JL_NORETURN jl_type_error(const char *fname,
1874-
jl_value_t *expected JL_MAYBE_UNROOTED,
1875-
jl_value_t *got JL_MAYBE_UNROOTED);
1874+
jl_value_t *expected JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED,
1875+
jl_value_t *got JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED);
18761876
JL_DLLEXPORT void JL_NORETURN jl_type_error_rt(const char *fname,
18771877
const char *context,
1878-
jl_value_t *ty JL_MAYBE_UNROOTED,
1879-
jl_value_t *got JL_MAYBE_UNROOTED);
1878+
jl_value_t *ty JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED,
1879+
jl_value_t *got JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED);
18801880
JL_DLLEXPORT void JL_NORETURN jl_undefined_var_error(jl_sym_t *var);
18811881
JL_DLLEXPORT void JL_NORETURN jl_has_no_field_error(jl_sym_t *type_name, jl_sym_t *var);
18821882
JL_DLLEXPORT void JL_NORETURN jl_atomic_error(char *str);

src/rtutils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ JL_DLLEXPORT void JL_NORETURN jl_too_many_args(const char *fname, int max)
109109

110110
// with function name / location description, plus extra context
111111
JL_DLLEXPORT void JL_NORETURN jl_type_error_rt(const char *fname, const char *context,
112-
jl_value_t *expected JL_MAYBE_UNROOTED,
113-
jl_value_t *got JL_MAYBE_UNROOTED)
112+
jl_value_t *expected JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED,
113+
jl_value_t *got JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED)
114114
{
115115
jl_value_t *ctxt=NULL;
116116
JL_GC_PUSH3(&ctxt, &expected, &got);
@@ -121,8 +121,8 @@ JL_DLLEXPORT void JL_NORETURN jl_type_error_rt(const char *fname, const char *co
121121

122122
// with function name or description only
123123
JL_DLLEXPORT void JL_NORETURN jl_type_error(const char *fname,
124-
jl_value_t *expected JL_MAYBE_UNROOTED,
125-
jl_value_t *got JL_MAYBE_UNROOTED)
124+
jl_value_t *expected JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED,
125+
jl_value_t *got JL_MAYBE_UNROOTED JL_MAYBE_UNPINNED)
126126
{
127127
jl_type_error_rt(fname, "", expected, got);
128128
}

0 commit comments

Comments
 (0)