{"id":810296,"url":"http://patchwork.ozlabs.org/api/1.2/patches/810296/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170905213905.GJ2323@tucnak/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170905213905.GJ2323@tucnak>","list_archive_url":null,"date":"2017-09-05T21:39:05","name":"[committed] Fix OpenMP lowering related ICE (PR middle-end/81768)","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"08303f26815b9f74aaa1270bb06cd797e961effe","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/1.2/people/671/?format=json","name":"Jakub Jelinek","email":"jakub@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170905213905.GJ2323@tucnak/mbox/","series":[{"id":1655,"url":"http://patchwork.ozlabs.org/api/1.2/series/1655/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1655","date":"2017-09-05T21:39:05","name":"[committed] Fix OpenMP lowering related ICE (PR middle-end/81768)","version":1,"mbox":"http://patchwork.ozlabs.org/series/1655/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810296/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810296/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461544-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461544-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Kvg2MIk2\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xn0V22GL8z9t2R\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 07:39:21 +1000 (AEST)","(qmail 59946 invoked by alias); 5 Sep 2017 21:39:15 -0000","(qmail 59329 invoked by uid 89); 5 Sep 2017 21:39:15 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 05 Sep 2017 21:39:10 +0000","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.11])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id B81B17266E\tfor\n\t<gcc-patches@gcc.gnu.org>; Tue,  5 Sep 2017 21:39:08 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-33.ams2.redhat.com\n\t[10.36.116.33])\tby smtp.corp.redhat.com (Postfix) with ESMTPS\n\tid 597025B818\tfor <gcc-patches@gcc.gnu.org>;\n\tTue,  5 Sep 2017 21:39:08 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v85Ld6v1002732\tfor\n\t<gcc-patches@gcc.gnu.org>; Tue, 5 Sep 2017 23:39:06 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v85Ld52k002731\tfor gcc-patches@gcc.gnu.org;\n\tTue, 5 Sep 2017 23:39:05 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:reply-to:mime-version:content-type;\n\tq=dns; s=default; b=I0p93eiYmgvqN9DvfvpEAuDaszU5lhWq3MlakK4ONje\n\tovgnOZqI9v0eS3+Z+6YYqdZSCh0voyFV5BTfSU70q7a7igaEsF4zlnT1iqC3uoNL\n\tj1W1aKepDYZLpThOqDFUBebnpHpaQJICHHbApkAKKbNHZOga6emWas1jY4kw8OdE\n\t=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:reply-to:mime-version:content-type;\n\ts=default; bh=0KIZyH0wjhMlPwtc5gVjvumrONg=; b=Kvg2MIk2R1jGlqVU9\n\tjzOE4VORg0huraUc5tktxSwgYigaRIGhOg7c3VaZyangSjNwEgREJ5yiFL8sKxk/\n\td3t13Crj46lCALS3uKynRvGnZb/djZ7vrJyedXo5RZV42duNDPmFqB2wXeUeLQ9G\n\t5n7hSj6PxbPG/UpsdTV78JHj0w=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com B81B17266E","Date":"Tue, 5 Sep 2017 23:39:05 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"gcc-patches@gcc.gnu.org","Subject":"[committed] Fix OpenMP lowering related ICE (PR middle-end/81768)","Message-ID":"<20170905213905.GJ2323@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"},"content":"Hi!\n\nOn the following testcase we ICE because during OpenMP lowering we failed\nto recompute ADDR_EXPR invariants after a VAR_DECL has been replaced by a\ntarget mapping.  Normally this is done in lower_omp_regimplify_p, but\nthe OMP_FOR initial/final trees don't go through that.\n\nFixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,\ncommitted so far to trunk.\n\n2017-09-05  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR middle-end/81768\n\t* omp-low.c (lower_omp_for): Recompute tree invariant if\n\tgimple_omp_for_initial/final is ADDR_EXPR.\n\n\t* gcc.dg/gomp/pr81768-2.c: New test.\n\n\n\tJakub","diff":"--- gcc/omp-low.c.jj\t2017-09-01 09:25:46.000000000 +0200\n+++ gcc/omp-low.c\t2017-09-05 15:07:10.086125109 +0200\n@@ -6923,10 +6923,14 @@ lower_omp_for (gimple_stmt_iterator *gsi\n       rhs_p = gimple_omp_for_initial_ptr (stmt, i);\n       if (!is_gimple_min_invariant (*rhs_p))\n \t*rhs_p = get_formal_tmp_var (*rhs_p, &body);\n+      else if (TREE_CODE (*rhs_p) == ADDR_EXPR)\n+\trecompute_tree_invariant_for_addr_expr (*rhs_p);\n \n       rhs_p = gimple_omp_for_final_ptr (stmt, i);\n       if (!is_gimple_min_invariant (*rhs_p))\n \t*rhs_p = get_formal_tmp_var (*rhs_p, &body);\n+      else if (TREE_CODE (*rhs_p) == ADDR_EXPR)\n+\trecompute_tree_invariant_for_addr_expr (*rhs_p);\n \n       rhs_p = &TREE_OPERAND (gimple_omp_for_incr (stmt, i), 1);\n       if (!is_gimple_min_invariant (*rhs_p))\n--- gcc/testsuite/gcc.dg/gomp/pr81768-2.c.jj\t2017-09-05 15:08:15.989343325 +0200\n+++ gcc/testsuite/gcc.dg/gomp/pr81768-2.c\t2017-09-05 14:25:43.000000000 +0200\n@@ -0,0 +1,15 @@\n+/* PR middle-end/81768 */\n+/* { dg-do compile } */\n+\n+float b[10][15][10];\n+\n+void\n+foo (void)\n+{\n+  float *i;\n+#pragma omp target parallel for schedule(static, 32) collapse(3)\n+  for (i = &b[0][0][0]; i < &b[0][0][10]; i++)\n+    for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)\n+      for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)\n+        b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] -= 3.5;\n+}\n","prefixes":["committed"]}