From: yu.dongliang Date: Thu, 20 Oct 2022 08:20:41 +0000 (+0800) Subject: fix: core dump when '(*p)++' X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=301356e89ba5b90194c04d18e27537b630a562fd;p=scf.git fix: core dump when '(*p)++' --- diff --git a/core/scf_optimizer_pointer_alias.c b/core/scf_optimizer_pointer_alias.c index 583cdb1..13dd2c4 100644 --- a/core/scf_optimizer_pointer_alias.c +++ b/core/scf_optimizer_pointer_alias.c @@ -370,16 +370,19 @@ static int __optimize_alias_bb(scf_list_t** pend, scf_list_t* start, scf_basic_b if (i > 0) break; - pointer = c->srcs->data[1]; - dn_pointer = pointer->dag_node; + if (c->srcs->size > 1) { - if (SCF_OP_DEREFERENCE == dn_pointer->type) { + pointer = c->srcs->data[1]; + dn_pointer = pointer->dag_node; - ret = __optimize_alias_dereference(pointer, c, bb, bb_list_head); - if (ret < 0) - return ret; + if (SCF_OP_DEREFERENCE == dn_pointer->type) { - flag += ret; + ret = __optimize_alias_dereference(pointer, c, bb, bb_list_head); + if (ret < 0) + return ret; + + flag += ret; + } } pointer = c->srcs->data[0];