From patchwork Wed Feb 5 10:39:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1233763 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-518938-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=n7SAaXL8; 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=Tj/1wdkA; 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 48CJ3B0M0Wz9sST for ; Wed, 5 Feb 2020 21:39:31 +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:date :from:to:subject:message-id:reply-to:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=UkwkYGhG1voGbOyS RWxtXA5jzfEKCkWL/JB/Tp8UcUxGW6awItuvPq7gFvoPZlv51PQ0Vsl3hMt5NUpS p/Eao4oF19JDlkWdPnPqY6NhE/SLk+0sroMzzXyoukHKjoYkEeWK0vRKHA3BDjce JuYX7Wy0JYr32Ke5DbgCQhJ60cU= 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:date :from:to:subject:message-id:reply-to:mime-version:content-type :content-transfer-encoding; s=default; bh=sLzzC1rXWeooW/8tdTaAPx OsfR4=; b=n7SAaXL8nH5Rx5pS83VXSOX2ySVJpim6ya7EJ9xBo//ZG1Ah0bD+Qf Fary4NN5RksKQ8QJ6/0jdPKSeIq1t6uA+kpHMJagxHjsAd/Cu4I3H8NyKUyUrbJ+ aI34j8/WdVJ7ZuP3utENtD6qHnW5Bok99wKKWVegjBvIzhDRPPwLQ= Received: (qmail 28333 invoked by alias); 5 Feb 2020 10:39:23 -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 28325 invoked by uid 89); 5 Feb 2020 10:39:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= 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; Wed, 05 Feb 2020 10:39:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580899160; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qCMMlxu0WeruFMOeeKlCw+NS70AerOVAXRJUcU7GMXc=; b=Tj/1wdkA7l3rMIKDKMRQf8kRKyJHnl92apQW/LCKbNMuzr2aADvz6xfomOfQMLPcs2DCQa HBYeGzCZPvearuPZ+sJiDjLnUQSDcRJuaF0Z+0obRlgozIZVk4qFDfqRDnsMfiWwDIyW15 kJLkzi4GrUBKeoVHRiXh7upvtne0DO8= 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-29-rx6PHIq0OhqYaeNxT0IFBA-1; Wed, 05 Feb 2020 05:39:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28050800D54 for ; Wed, 5 Feb 2020 10:39:17 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C465D5DA7B for ; Wed, 5 Feb 2020 10:39:16 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 015AdEQ8020397 for ; Wed, 5 Feb 2020 11:39:15 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 015AdDuE020396 for gcc-patches@gcc.gnu.org; Wed, 5 Feb 2020 11:39:13 +0100 Date: Wed, 5 Feb 2020 11:39:13 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] openmp: Avoid ICEs with declare simd; declare simd inbranch [PR93555] Message-ID: <20200205103913.GY17695@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-IsSubscribed: yes Hi! The testcases ICE because when processing the declare simd inbranch, we don't create the i == 0 clone as it already exists, which means clone_info->nargs is not adjusted, but we then rely on it being adjusted when trying other clones. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2020-02-05 Jakub Jelinek PR middle-end/93555 * omp-simd-clone.c (expand_simd_clones): If simd_clone_mangle or simd_clone_create failed when i == 0, adjust clone->nargs by clone->inbranch. * c-c++-common/gomp/pr93555-1.c: New test. * c-c++-common/gomp/pr93555-2.c: New test. * gfortran.dg/gomp/pr93555.f90: New test. Jakub --- gcc/omp-simd-clone.c.jj 2020-01-12 11:54:36.688409260 +0100 +++ gcc/omp-simd-clone.c 2020-02-04 18:08:11.271036096 +0100 @@ -1713,14 +1713,22 @@ expand_simd_clones (struct cgraph_node * already. */ tree id = simd_clone_mangle (node, clone); if (id == NULL_TREE) - continue; + { + if (i == 0) + clone->nargs += clone->inbranch; + continue; + } /* Only when we are sure we want to create the clone actually clone the function (or definitions) or create another extern FUNCTION_DECL (for prototypes without definitions). */ struct cgraph_node *n = simd_clone_create (node); if (n == NULL) - continue; + { + if (i == 0) + clone->nargs += clone->inbranch; + continue; + } n->simdclone = clone; clone->origin = node; --- gcc/testsuite/c-c++-common/gomp/pr93555-1.c.jj 2020-02-04 22:28:54.557506688 +0100 +++ gcc/testsuite/c-c++-common/gomp/pr93555-1.c 2020-02-04 22:30:18.575246428 +0100 @@ -0,0 +1,18 @@ +/* PR middle-end/93555 */ +/* { dg-do compile } */ + +#pragma omp declare simd +#pragma omp declare simd inbranch +int +foo (int x) +{ + return x; +} + +#pragma omp declare simd inbranch +#pragma omp declare simd +int +bar (int x) +{ + return x; +} --- gcc/testsuite/c-c++-common/gomp/pr93555-2.c.jj 2020-02-04 22:28:57.581461328 +0100 +++ gcc/testsuite/c-c++-common/gomp/pr93555-2.c 2020-02-04 22:30:25.712139374 +0100 @@ -0,0 +1,16 @@ +/* PR middle-end/93555 */ +/* { dg-do compile } */ + +#pragma omp declare simd +#pragma omp declare simd inbranch +void +foo (void) +{ +} + +#pragma omp declare simd inbranch +#pragma omp declare simd +void +bar (void) +{ +} --- gcc/testsuite/gfortran.dg/gomp/pr93555.f90.jj 2020-02-04 22:31:27.578211386 +0100 +++ gcc/testsuite/gfortran.dg/gomp/pr93555.f90 2020-02-04 22:31:18.267351050 +0100 @@ -0,0 +1,11 @@ +! PR middle-end/93555 +! { dg-do compile } + +subroutine foo + !$omp declare simd(foo) + !$omp declare simd(foo) inbranch +end +subroutine bar + !$omp declare simd(bar) inbranch + !$omp declare simd(bar) +end