From patchwork Mon Feb 10 23:17:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1236035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519293-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=b/55lCv1; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hnfUqR/X; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48GhdK3Pfgz9sP7 for ; Tue, 11 Feb 2020 10:17:25 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=ay198b/yxb0D59GJ n8ocI+AE4QBrawDNrW5SytypjYiagQq5sEdHA2K5kytbkYlLqxY3BW8cuxgD2uyK 1RqwbHGOe8vCYrRDnmy+tJtl0mvccNRllxbMETOZfsJRZr39MHl5oIsLVCoCjWae 0IyOU+nNjzTn8zeAf5Z9FA0nFKA= 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:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=jw0ANPTE/3pCRe9EN9+YmN 3oyZI=; b=b/55lCv1qYtbCjMIp0q5Z5NbmEGmA2Vi8ksMfxYxxtypRQ1AHEY1Aq lI6CxkdDCNpWo3P8ZDU9dSdw9tZWWVlYg0pfvwTocKAawNUhWql6hQ0bJLdKj6Lq w4ihYdVOJWI+7XSxUMMqB++IKl4eP/ln+nY8a9cEsBwZEW6qUA3go= Received: (qmail 54463 invoked by alias); 10 Feb 2020 23:17:17 -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 54450 invoked by uid 89); 10 Feb 2020 23:17:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=RECORD_TYPE, record_type X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Feb 2020 23:17:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581376633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0eb9aI1CyktteRk83+dlCdfkymG2DzkecwIV18z2TYQ=; b=hnfUqR/Xs4DTY1PexdEYDkpoebdwuC7xlHZjL5BgPC2alyJrgcT78f6onpJ3kFUMaP74X0 dwRUulWde54+JTPOir5v4ZNOB9MkY+Py5cLVUyBcPWn/c5oZYXXbgoKzXCByCJWibGSkQe wBoQwMYp7FMPnUXL5J1DrCprk4c3hB8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-271-MOyO5oTHM6yTlidPfTQyJQ-1; Mon, 10 Feb 2020 18:17:12 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58081107ACC7 for ; Mon, 10 Feb 2020 23:17:11 +0000 (UTC) Received: from t470.redhat.com (ovpn-116-56.phx2.redhat.com [10.3.116.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id E45CB8EA1C; Mon, 10 Feb 2020 23:17:10 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [committed] analyzer: handle vector types (PR 93350) Date: Mon, 10 Feb 2020 18:17:09 -0500 Message-Id: <20200210231709.32370-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to master as r10-6567-ge87deb37649cfe480217fc83c8d56fe925600f93. gcc/analyzer/ChangeLog: PR analyzer/93350 * region-model.cc (region_model::get_lvalue_1): Handle BIT_FIELD_REF. (make_region_for_type): Handle VECTOR_TYPE. gcc/testsuite/ChangeLog: PR analyzer/93350 * gcc.dg/analyzer/torture/pr93350.c: New test. --- gcc/analyzer/region-model.cc | 11 ++++++++++- gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index fd82360cc6e..ae810f5eb4b 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -4662,6 +4662,14 @@ region_model::get_lvalue_1 (path_var pv, region_model_context *ctxt) } break; + case BIT_FIELD_REF: + { + /* For now, create a view, as if a cast, ignoring the bit positions. */ + tree obj = TREE_OPERAND (expr, 0); + return get_or_create_view (get_lvalue (obj, ctxt), TREE_TYPE (expr)); + }; + break; + case MEM_REF: { tree ptr = TREE_OPERAND (expr, 0); @@ -6035,7 +6043,8 @@ make_region_for_type (region_id parent_rid, tree type) if (INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type) || POINTER_TYPE_P (type) - || TREE_CODE (type) == COMPLEX_TYPE) + || TREE_CODE (type) == COMPLEX_TYPE + || TREE_CODE (type) == VECTOR_TYPE) return new primitive_region (parent_rid, type); if (TREE_CODE (type) == RECORD_TYPE) diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c b/gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c new file mode 100644 index 00000000000..1799da1936c --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/torture/pr93350.c @@ -0,0 +1,11 @@ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-Wno-psabi" } */ + +typedef __INT32_TYPE__ int32_t; +typedef int32_t vnx4si __attribute__((vector_size (32))); + +__attribute__((noipa)) +vnx4si foo(int a, int b) +{ + return (vnx4si) { 1, 2, 3, 4, 5, 6, a, b }; +}