From patchwork Wed Nov 9 13:16:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 81480 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp190650qge; Wed, 9 Nov 2016 05:17:22 -0800 (PST) X-Received: by 10.99.100.132 with SMTP id y126mr26484722pgb.177.1478697442261; Wed, 09 Nov 2016 05:17:22 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id x3si42199454pgb.28.2016.11.09.05.17.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Nov 2016 05:17:22 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-440847-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-440847-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-440847-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=vdLlT48M446R3A3DAYffm7baz2tmml96Bk8WzOO0oDWb8zNNkr 4CtcfAri+a9bd7S6tWNNuOX12G9JonspajvKGir3Pey3XrdzujXzi2N51esOxJeJ uo/LCShp4bCqIkJ49AQ8PUxWuxwiKq32qDtwHX79eP0hr3JaGyqRokxuQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=2zkHKUUaJieSISAE19M179Ok/Dk=; b=ksSNEeCr3e+nLfZtjnJn IlWHT3KVqL+iqFFEGPjWTRgKJJW69wp3UcWvlyttaS9ZmcpcixD3B8Q1Vu9sJ42Z 5rTI9Qdjm0dPn6wBgBmZGtT5nIRlOYcXTWCkuB6unSBtPSdV3mhN92dqpRSGlVTO E64/7ogSIawARPE8zn6hZAA= Received: (qmail 118725 invoked by alias); 9 Nov 2016 13:16:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 118462 invoked by uid 89); 9 Nov 2016 13:16:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=*pre_p X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Nov 2016 13:16:48 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C522DADC6 for ; Wed, 9 Nov 2016 13:16:45 +0000 (UTC) To: GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Remove unneeded gcc_assert in gimplifier (PR sanitizer/78270) Message-ID: <475cb650-8a3d-8395-9f93-da12e8e841a1@suse.cz> Date: Wed, 9 Nov 2016 14:16:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes As shown in the attached test-case, the assert cannot always be true. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From b55459461f3f7396a094be6801082715ddb4b30d Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 9 Nov 2016 11:52:00 +0100 Subject: [PATCH] Remove unneeded gcc_assert in gimplifier (PR sanitizer/78270) gcc/ChangeLog: 2016-11-09 Martin Liska PR sanitizer/78270 * gimplify.c (gimplify_switch_expr): gcc/testsuite/ChangeLog: 2016-11-09 Martin Liska PR sanitizer/78270 * gcc.dg/asan/pr78269.c: New test. --- gcc/gimplify.c | 1 - gcc/testsuite/gcc.dg/asan/pr78269.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/asan/pr78269.c diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e5930e6..15976e2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2266,7 +2266,6 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p) labels = gimplify_ctxp->case_labels; gimplify_ctxp->case_labels = saved_labels; - gcc_assert (gimplify_ctxp->live_switch_vars->elements () == 0); delete gimplify_ctxp->live_switch_vars; gimplify_ctxp->live_switch_vars = saved_live_switch_vars; diff --git a/gcc/testsuite/gcc.dg/asan/pr78269.c b/gcc/testsuite/gcc.dg/asan/pr78269.c new file mode 100644 index 0000000..55840b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr78269.c @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-additional-options "-Wno-switch-unreachable" } + +typedef struct +{ +} bdaddr_t; + +int a; +void fn1 () +{ + switch (a) + &(bdaddr_t){}; +} -- 2.10.1