From patchwork Fri Mar 9 02:30:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 10269555 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 7F6896016D for ; Fri, 9 Mar 2018 02:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F3EE29BB9 for ; Fri, 9 Mar 2018 02:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E49029C52; Fri, 9 Mar 2018 02:30:25 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 E7E5B29BB9 for ; Fri, 9 Mar 2018 02:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750851AbeCICaX (ORCPT ); Thu, 8 Mar 2018 21:30:23 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37135 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbeCICaX (ORCPT ); Thu, 8 Mar 2018 21:30:23 -0500 Received: by mail-wm0-f67.google.com with SMTP id 139so1309018wmn.2 for ; Thu, 08 Mar 2018 18:30:22 -0800 (PST) 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=74FBh12dHv0ei8aX0wLb8szrbCPnmqbkmguJ8cTZPQI=; b=ntbPP+a2mNpt7aePPw5S6Pu2NjRIU1H3EwkZYhHT9EN+BHR4V1Rt/U57rTcxEjMPrI sqrWVWQp5puj7F8pdpNxQtf8WYGMR+DdiSlfd4WZFCc8jbU4yZEDLVaShWl3WGniNSdc L2QzvdVmfk+4uGFfXrEHyBaYLr6bubYA/oUwE7zVj8ck3k6tGPx/7shB8B25BMSMzAjQ R0g59EVJlP4hfswfWc2rLbt+c5CX4KL528JYH/J4drpagyVYAlCTvex7LNMeMueMl5Kg jPOk3NGl69b76jMDvExz3vnB/ya/fMG2D5b2q42LNYldwVcBRbjYDVCPKMk5An5/AbsY YggA== 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=74FBh12dHv0ei8aX0wLb8szrbCPnmqbkmguJ8cTZPQI=; b=omMUoytSQashg3mSilPYluK1EPlOhdj5vT0eZ+ZdUe7F6nc/5EKZdqeGGnZu1LxFIx wa77ELs5Z3jyXqVRwqc/GHs14FUoZko0ftTnA4dTVlZ14ZHquZckOBWi7SoEa+mJTE3R 4aiAEb0e7IOg0SUYsKHi8qq2Jh/EvGwSIRV5KWI3q5wONkVL5yAR841k4SECwqjvwX10 F3V0btzZVwu1XXda9VlGr5lmBXIvIaJCMlctY71zOX8mmslewF3GPXOM7RAFArQqfSjK 2c/Bkgchf/pw5ExSg9/4um4A/Z+F2ByAVrD5ggq4KkcP2nYEk7uZA11chIQqhCTNQlKT 0e/w== X-Gm-Message-State: APf1xPBFmaV+P9w5jSTLeiScd2yL9OdQWMhU4dyJHNDnxaVC9JzS2KeE Q2ZEYPu7gfyIifLVQClqAeuPeGS0 X-Google-Smtp-Source: AG47ELuWNju8MJAASl2805Ia0WX+k+nLryT6pQYa+VULVBFHFArFm1peyQTwbj+su6sUX/A6MvSS9w== X-Received: by 10.80.245.16 with SMTP id t16mr35623972edm.168.1520562621604; Thu, 08 Mar 2018 18:30:21 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:402a:9e00:b509:133b:1e4b:f083]) by smtp.gmail.com with ESMTPSA id y58sm163915edd.81.2018.03.08.18.30.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 18:30:21 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 1/5] symaddr: add test cases Date: Fri, 9 Mar 2018 03:30:06 +0100 Message-Id: <20180309023010.94475-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309023010.94475-1-luc.vanoostenryck@gmail.com> References: <20180309023010.94475-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 Add a few testcases showing problems introduced with the removal of OP_SYMADDRs. Signed-off-by: Luc Van Oostenryck --- validation/mem2reg/address-used00.c | 1 + validation/symaddr-op.c | 18 ++++++++++++++++++ validation/symaddr.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 validation/symaddr-op.c create mode 100644 validation/symaddr.c diff --git a/validation/mem2reg/address-used00.c b/validation/mem2reg/address-used00.c index f2d6c87bd..a41f05c25 100644 --- a/validation/mem2reg/address-used00.c +++ b/validation/mem2reg/address-used00.c @@ -16,4 +16,5 @@ int foo(int **g, int j) * check-known-to-fail * check-output-ignore * check-output-excludes: ret\\..* \\$1 + * check-output-contains: ret\\..* \\$0 */ diff --git a/validation/symaddr-op.c b/validation/symaddr-op.c new file mode 100644 index 000000000..c17c328f8 --- /dev/null +++ b/validation/symaddr-op.c @@ -0,0 +1,18 @@ +struct s { + int c; + char a[]; +} s; + +char foo(int *ptr, long i) +{ + return s.a[i]; +} + +/* + * check-name: symaddr-op + * check-command: test-linearize -m64 -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: add.64 .* <- s, + */ diff --git a/validation/symaddr.c b/validation/symaddr.c new file mode 100644 index 000000000..97f640f91 --- /dev/null +++ b/validation/symaddr.c @@ -0,0 +1,32 @@ +int g; +int a[3]; +int b[3]; + +void usep(int*); + +int foo(void) +{ + int r = 0; + usep(&g); + usep(a); + usep(b + 1); + return r; +} + +/* + * check-name: symaddr + * check-command: test-linearize -Wno-decl $file + * + * check-output-start +foo: +.L0: + + call usep, g + call usep, a + add.64 %r4 <- b, $4 + call usep, %r4 + ret.32 $0 + + + * check-output-end + */