From 301356e89ba5b90194c04d18e27537b630a562fd Mon Sep 17 00:00:00 2001 From: "yu.dongliang" Date: Thu, 20 Oct 2022 16:20:41 +0800 Subject: [PATCH] fix: core dump when '(*p)++' --- core/scf_optimizer_pointer_alias.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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]; -- 2.25.1