From patchwork Mon Jul 31 20:36:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9873115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 002AE6037D for ; Mon, 31 Jul 2017 20:36:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E36B127F3E for ; Mon, 31 Jul 2017 20:36:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8522285DC; Mon, 31 Jul 2017 20:36:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90C5527F3E for ; Mon, 31 Jul 2017 20:36:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751199AbdGaUgk (ORCPT ); Mon, 31 Jul 2017 16:36:40 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33344 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbdGaUgj (ORCPT ); Mon, 31 Jul 2017 16:36:39 -0400 Received: by mail-wm0-f66.google.com with SMTP id q189so234881wmd.0 for ; Mon, 31 Jul 2017 13:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l0YiMzemJRKYK2682obnUEW8Pfgl+o0mfuHdKIdtB2I=; b=VikF4H0+qkqnItlvc9OYG9pwNsQt4K8VIzqFQbOVB4F463BcblBCfwoaKxLt7nY7Iu gP+nqwdo6keXmK1GefXucVnMcIN3FBiKPvNQKxn+4aUOr7ZM/mYG3fISBqQdL9i+xLAp p9V5x79XVxhkzANx55pvFsmCresoC50FpxFPwWuKEyp/TVL0k1BKo3HQCJUB1yvH8q63 Q00NUZAhgYkQjtb9M4Qxccz47VnlZ8ZklxiM4tM2MTmsvcnG8jJIE4i7WIqGKqqYJy4b avID4pO7eTXSeM4WQg+aNgE8c6Wa7nZoDOqxWgmctIHMTfA6tp4VB6rLmyb7gLcaIfPg x3xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l0YiMzemJRKYK2682obnUEW8Pfgl+o0mfuHdKIdtB2I=; b=PMEECjce7Si1H0/EFJkR/5SyAPQ5LdxXtSiMobDmzTpjWqmknPYmgoiaEc78eyH/8Q F4q/Z7fC2GCxWa+mhhkCbV1oqF15u2kHTNLkORrRpQNZ7xOPyZRO1sRX+NvPhlG3Berg PUyG8/GOZGlYYRn4ChLRClQsemBPW9u1eK6+wZrcXc34EzpuwgZuBLXo2Y71zhrtWJ3/ 2cJqp0Id7ZIkIS8FWv5c/iW0Q3K15K5C73+z8jsnn2DCiDBtnk6luFX0Hel3LEwbpzXR JuJOZqkABFxvuqs9yKMb6uZrQVRozAwgkA0zLtw0UbJUqlvoN3/PMZR1VLxCIWtrr1H/ 7WhA== X-Gm-Message-State: AIVw112kZA5g9d38K5BdSYb+0oUuz03AOfNV2/PMzNv7atxLqS6H7Tri eMRxfpMYQi7yOg== X-Received: by 10.28.34.130 with SMTP id i124mr12748614wmi.135.1501533398597; Mon, 31 Jul 2017 13:36:38 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:40c4:ab00:f976:d678:e4f6:5c60]) by smtp.gmail.com with ESMTPSA id n7sm47682350wrb.37.2017.07.31.13.36.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jul 2017 13:36:38 -0700 (PDT) From: Luc Van Oostenryck To: Christopher Li Cc: linux-sparse@vger.kernel.org, Michael Stefaniuc , Luc Van Oostenryck Subject: [PATCH v3 5/7] fix crash in rewrite_branch() Date: Mon, 31 Jul 2017 22:36:22 +0200 Message-Id: <20170731203624.58971-6-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170731203624.58971-1-luc.vanoostenryck@gmail.com> References: <20170731203624.58971-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Luc Van Oostenryck --- flow.c | 2 +- validation/crash-rewrite-branch.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 validation/crash-rewrite-branch.c diff --git a/flow.c b/flow.c index 23fa7c21b..6cac21b24 100644 --- a/flow.c +++ b/flow.c @@ -30,7 +30,7 @@ static int rewrite_branch(struct basic_block *bb, struct basic_block *old, struct basic_block *new) { - if (*ptr != old || new == old) + if (*ptr != old || new == old || !bb->ep) return 0; /* We might find new if-conversions or non-dominating CSEs */ diff --git a/validation/crash-rewrite-branch.c b/validation/crash-rewrite-branch.c new file mode 100644 index 000000000..eb310df1c --- /dev/null +++ b/validation/crash-rewrite-branch.c @@ -0,0 +1,24 @@ +void a(int c, int e) +{ + for(; b; c ; + + if (()) { + unsigned short d = e; + if (()) + while () + ; + &d; + } + + if (()) { + int f = &f; + } +} + +/* + * check-name: crash rewrite_branch + * check-command: test-linearize $file + * + * check-error-ignore + * check-output-ignore + */