From patchwork Fri Nov 22 11:06:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1199416 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-514390-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fWJMp4BJ"; 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 47KDBv1MjFz9sWd for ; Fri, 22 Nov 2019 22:06:30 +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 :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=eUl1gazt8mAUzgslBBdxVPqhrKHpN3WXZImt6/aJd1qgFoMuWEIvp 5bviuNWlVY5dmLm8ZgYEvUPz9G0318DZJVW5JZePRpuxxpER1CsWYgY5cYPRhfdh 24LONlNl+KLojfPebICu+pDFuJwSLtsHOEbEYM+wUnM9wqQYse5Uu0= 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 :subject:to:message-id:date:mime-version:content-type; s= default; bh=rJR9F85rS/EPRSAMrQCFFUtYxTA=; b=fWJMp4BJWKfq3yQvcmbZ H7zJ/H/CJ5c270OvEOD+HgzgJWiQ9LX9M8s+xwBN7sWVCqmHAaqExqMYgmH3g7SL Ingw52Jn1zBI+bauIuvkuyXFAG8Dd0dKFIs7i2obEq8gR0s5bZ9/edKbm//8eAcA CbwU8Wp+CC2dzbuQQRVyNGQ= Received: (qmail 109307 invoked by alias); 22 Nov 2019 11:06: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 109296 invoked by uid 89); 22 Nov 2019 11:06:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=Graphics, graphics, HX-Languages-Length:1616 X-HELO: esa3.mentor.iphmx.com Received: from esa3.mentor.iphmx.com (HELO esa3.mentor.iphmx.com) (68.232.137.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Nov 2019 11:06:21 +0000 IronPort-SDR: c9lSDkEKQPve+Cu5tUgG5MaBo3nCNltnsyVtgyXhPmGskd4A7FOFPHYpNzjTcYpkHdLMe/2QwG KCf516Iqbj+21WAxmsWnaOmhkEfEKA9Sjn/qoEZ5SDHODPb1Rk6kxizHFRYKlbH+tj/HZmTajF QYmFUs79MMjPVBX+azch/iSKeiE1MXqfUQrCmdoACu3SoGJ3EcBWNUURWfJXtIvcbOylttkF/H zcb6qhYZMSFvAXyXC0f5aEA2YFWnBxz8Uu1x/AqQtL0KH86FRY8espl6TrsqtSaLfyVQjzx1EG 3cw= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 22 Nov 2019 03:06:19 -0800 IronPort-SDR: 4/gfekOntaBpeuKca9TD5/OsH0LOK01fOT1G2YLM3cgmfLeHw8nAWuBX8vfomhckcNRbxp7opB qYq2K9mMZN0v6WuLn5/tSU/U2py3Mz8qg46cozceGXLaU/gry/oxc7bD/ESzOkcC5Kb9nrMMTF UTgVR/fsu3sjZwR+taRdBlJ5/IM07EK8L7t/G/7EmMm7KGpwaWbXihC3Az+/9svGzewJ53rOe8 zgxmSZroxKCQ58KyguKmcr6IXQ1e6IIbSrauac5NKfog4wXGAmElWf0ihCvwo4qAGHScSQo/tC z3w= From: Andrew Stubbs Subject: [patch, openacc] Fix ICE verifying gimple To: "gcc-patches@gcc.gnu.org" Message-ID: Date: Fri, 22 Nov 2019 11:06:14 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 This test case causes an ICE (reformatted for email): void test(int k) { unsigned int x = 1; #pragma acc parallel loop async(x) for (int i = 0; i < k; i++) { } } t.c: In function 'test': t.c:4:9: error: invalid argument to gimple call 4 | #pragma acc parallel loop async(x) | ^~~ (int) x __builtin_GOACC_parallel_keyed (-1, test._omp_fn.0, 1, &.omp_data_arr.3, &.omp_data_sizes.4, &.omp_data_kinds.5, 536936447, (int) x, 0); during GIMPLE pass: ompexp dump file: t.c.013t.ompexp t.c:4:9: internal compiler error: verify_gimple failed The problem is that "x" needs to be cast to "int" (from "unsigned int") before calling the function, and that's not valid in a gimple call. The attached patch assigns the "(int) x" to a temporary and passes that to the function instead. OK to commit? Normalize GOACC_parallel_keyed async parameter. 2019-11-22 Andrew Stubbs gcc/ * omp-expand.c (expand_omp_target): Pass sync parameter to GOACC_parallel_keyed via a temporary variable. diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 6f945011cf5..08f95587e95 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -8418,7 +8418,12 @@ expand_omp_target (struct omp_region *region) i_async)); } if (t_async) - args.safe_push (t_async); + { + tree tmp = create_tmp_var (TREE_TYPE (t_async)); + gimple *stmt = gimple_build_assign (tmp, t_async); + gsi_insert_before (&gsi, stmt, GSI_SAME_STMT); + args.safe_push (tmp); + } /* Save the argument index, and ... */ unsigned t_wait_idx = args.length ();