Skip to content

Commit 1547541

Browse files
author
Erlang/OTP
committed
Merge branch 'rickard/fix-harmless-bugs-warnings/26' into maint-27
* rickard/fix-harmless-bugs-warnings/26: [erts] Silence faulty CodeChecker warnings [erts] Fix harmless initialization bug
2 parents d949010 + 2c6a538 commit 1547541

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

erts/emulator/beam/bif.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ BIF_RETTYPE link_1(BIF_ALIST_1)
159159
if (!prt)
160160
goto res_no_proc;
161161

162+
ERTS_UNDEF(ref, THE_NON_VALUE);
163+
162164
lnk = erts_link_internal_tree_lookup_create(&ERTS_P_LINKS(BIF_P),
163165
&created,
164166
ERTS_LNK_TYPE_PORT,
@@ -1100,6 +1102,8 @@ BIF_RETTYPE unlink_1(BIF_ALIST_1)
11001102
ErtsPortOpResult res = ERTS_PORT_OP_DROPPED;
11011103
Port *prt;
11021104

1105+
ERTS_UNDEF(ref, THE_NON_VALUE);
1106+
11031107
/* Send unlink signal */
11041108
prt = erts_port_lookup(BIF_ARG_1, ERTS_PORT_SFLGS_DEAD);
11051109
if (!prt) {

erts/emulator/beam/erl_alloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,6 +2907,7 @@ erts_allocator_options(void *proc)
29072907
hpp = NULL;
29082908
szp = &sz;
29092909
sz = 0;
2910+
ERTS_UNDEF(hp, NULL);
29102911

29112912
bld_term:
29122913

erts/emulator/beam/erl_bif_info.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3857,6 +3857,7 @@ fun_info_2(BIF_ALIST_2)
38573857
case am_module:
38583858
/* Unloaded funs must report their module even though we can't find
38593859
* their full MFA. */
3860+
ASSERT(fe != NULL || mfa != NULL);
38603861
val = (mfa != NULL) ? mfa->module : fe->module;
38613862
hp = HAlloc(p, 3);
38623863
break;

erts/emulator/beam/erl_db_hash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,7 @@ int db_erase_hash(DbTable *tbl, Eterm key, Eterm *ret)
16451645
bp = &b->next;
16461646
b = b->next;
16471647
}
1648+
ERTS_UNDEF(nitems, -1);
16481649
if (nitems_diff) {
16491650
ADD_NITEMS(tb, lck_ctr, hval, nitems_diff);
16501651
nitems = NITEMS_ESTIMATE(tb, lck_ctr, hval);
@@ -1710,6 +1711,7 @@ static int db_erase_object_hash(DbTable *tbl, Eterm object, Eterm *ret)
17101711
bp = &b->next;
17111712
b = b->next;
17121713
}
1714+
ERTS_UNDEF(nitems, -1);
17131715
if (nitems_diff) {
17141716
ADD_NITEMS(tb, lck_ctr, hval, nitems_diff);
17151717
nitems = NITEMS_ESTIMATE(tb, lck_ctr, hval);
@@ -2975,6 +2977,7 @@ static int db_take_hash(Process *p, DbTable *tbl, Eterm key, Eterm *ret)
29752977
break;
29762978
}
29772979
}
2980+
ERTS_UNDEF(nitems, -1);
29782981
if (nitems_diff) {
29792982
ADD_NITEMS(tb, lck_ctr, hval, nitems_diff);
29802983
nitems = NITEMS_ESTIMATE(tb, lck_ctr, hval);

erts/emulator/beam/erl_proc_sig_queue.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,6 +4292,7 @@ handle_exit_signal(Process *c_p, ErtsSigRecvTracing *tracing,
42924292
Eterm reason;
42934293
Eterm from;
42944294

4295+
ERTS_UNDEF(reason, THE_NON_VALUE);
42954296
ASSERT(ERTS_PROC_SIG_TYPE(tag) == ERTS_SIG_Q_TYPE_GEN_EXIT);
42964297

42974298
xsigd = get_exit_signal_data(sig);
@@ -4788,6 +4789,8 @@ handle_persistent_mon_msg(Process *c_p, ErtsSigRecvTracing *tracing,
47884789
ErtsMessage *first = NULL, *prev, *last;
47894790
Uint hsz = size_object(msg);
47904791
Uint i;
4792+
ERTS_UNDEF(last,NULL);
4793+
ERTS_UNDEF(prev,NULL);
47914794

47924795
for (i = 0; i < n; i++) {
47934796
Eterm *hp;
@@ -9023,11 +9026,9 @@ erts_proc_sig_queue_try_enqueue_to_buffer(Eterm from,
90239026
int nonmsg = ERTS_SIG_IS_NON_MSG(first);
90249027
int restarted = 0;
90259028
ErtsSignalInQueueBuffer* buffer;
9026-
Uint64 nonempty_slots_before;
9029+
Uint64 nonempty_slots_before = 0;
90279030
Uint32 slot, state;
90289031

9029-
ERTS_UNDEF(nonempty_slots_before, 0);
9030-
90319032
ASSERT(is_value(from));
90329033

90339034
/* Use the sender id to hash to an outer signal queue buffer. This

erts/emulator/beam/erl_process.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10726,6 +10726,7 @@ execute_sys_tasks(Process *c_p, erts_aint32_t *statep, int in_reds)
1072610726
if (c_p->flags & F_DISABLE_GC) {
1072710727
save_gc_task(c_p, st, st_prio);
1072810728
st = NULL;
10729+
ERTS_UNDEF(st_res, am_undefined);
1072910730
reds--;
1073010731
}
1073110732
else {
@@ -10739,6 +10740,7 @@ execute_sys_tasks(Process *c_p, erts_aint32_t *statep, int in_reds)
1073910740
if (c_p->flags & (F_DIRTY_MAJOR_GC|F_DIRTY_MINOR_GC)) {
1074010741
save_dirty_task(c_p, st);
1074110742
st = NULL;
10743+
ERTS_UNDEF(st_res, am_undefined);
1074210744
break;
1074310745
}
1074410746
if (type == ERTS_PSTT_GC_MAJOR)
@@ -10781,6 +10783,7 @@ execute_sys_tasks(Process *c_p, erts_aint32_t *statep, int in_reds)
1078110783
* but instead unconditionally schedule this as dirty
1078210784
* work...
1078310785
*/
10786+
ERTS_UNDEF(st_res, am_undefined);
1078410787
if (c_p->flags & F_DISABLE_GC) {
1078510788
/* We might need to GC, but GC was disabled */
1078610789
save_gc_task(c_p, st, st_prio);
@@ -13031,8 +13034,10 @@ erts_send_local_spawn_reply(Process *parent, ErtsProcLocks parent_locks,
1303113034

1303213035
type = child ? am_ok : am_error;
1303313036

13034-
if (have_seqtrace(token) && child)
13037+
if (have_seqtrace(token) && child) {
1303513038
token_sz = size_object(token);
13039+
ERTS_UNDEF(token_copy, NIL);
13040+
}
1303613041
else {
1303713042
token_copy = token = NIL;
1303813043
token_sz = 0;

0 commit comments

Comments
 (0)