From patchwork Wed Mar 18 14:17:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 1257527 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Yjg6AzJ7; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48jBvd51xDz9sRN for ; Thu, 19 Mar 2020 01:17:48 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA7FA3942020; Wed, 18 Mar 2020 14:17:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA7FA3942020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584541066; bh=CDVkjVXhej2Se49LoCLjNVU7OqsWhuja5H1/ssnFY6o=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Yjg6AzJ77fpFzeXorCEQSWT1Xf+wZLRpD0KwBrO44ytWH/ppikHqvuosrSQMHaqXr RQGA9th92JvNppNwOZdBOdJfGeSrDaH9VUwALX6+QMwkF+kCweyIqFn5KaI2B/O3aG Eh25OVn4ZtRw3d2OL8/lrVKci3VGnOmSsiKtRJiw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by sourceware.org (Postfix) with ESMTP id 41E663940CEC for ; Wed, 18 Mar 2020 14:17:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 41E663940CEC 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-487-2y45kArpMmqsgf-PELaOLw-1; Wed, 18 Mar 2020 10:17:37 -0400 X-MC-Unique: 2y45kArpMmqsgf-PELaOLw-1 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 463691005F89 for ; Wed, 18 Mar 2020 14:17:36 +0000 (UTC) Received: from t470.redhat.com (ovpn-114-15.phx2.redhat.com [10.3.114.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDE21BBBD0; Wed, 18 Mar 2020 14:17:34 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [committed] analyzer: add test coverage for fixed ICE [PR94047] Date: Wed, 18 Mar 2020 10:17:33 -0400 Message-Id: <20200318141733.8092-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-25.2 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Malcolm via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: David Malcolm Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" PR analyzer/94047 reports an ICE, which turned out to be caused by the erroneous use of TREE_TYPE on the view region's type in region_model::get_representative_path_var that I introduced in r10-7024-ge516294a1acb28aaaad44cfd583cc6a80354044e and fixed in g:787477a226033e36be3f6d16b71be13dd917e982. This patch adds a regression test for the ICE. Successfully regrtested on x86_64-pc-linux-gnu. Pushed to master as f665beeba625490bd96a593d23e00726d969cf98. gcc/testsuite/ChangeLog: PR analyzer/94047 * gcc.dg/analyzer/pr94047.c: New test. --- gcc/testsuite/gcc.dg/analyzer/pr94047.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr94047.c diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94047.c b/gcc/testsuite/gcc.dg/analyzer/pr94047.c new file mode 100644 index 00000000000..d989a254c9e --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr94047.c @@ -0,0 +1,23 @@ +/* { dg-additional-options "-Wno-analyzer-too-complex" } */ +/* TODO: the above ought not to be necessary, but currently is due to a + state explosion within the for loop. */ + +typedef struct list +{ + struct list *next; +} tlist; + +void +bar (struct list *l) +{ + l->next = l->next->next; +} + +void +foo (void) +{ + struct list l; + tlist t = l; + for (;;) + bar (&t); +}