From patchwork Fri Dec 6 00:04:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 297488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F38AC2C0077 for ; Fri, 6 Dec 2013 11:05:08 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=TL9kt8Kq31xexXlvQ1vhVRThdwZX9XWw8X3Li7I5CFSlXS fIy0Uds9tGmhX6FLxUte0oS3N/+OmFM/gUqzc1OVSUGrKgCWkmjM0vhlrNKwxQOt AIvMRkvoLeEsx1gQlMG7ATL09OFV2eOPsxB56Q/oLWLDhAADRCUnw3UuzOMeY= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=2dBjXohHvGczHy2hqz0pI7dd0FI=; b=sI4HRFoLFMIzKT5Idmwr ihHmhGfosetxUcNrisLJmMIkUdfMu2pHnGq+9UMC4JlHRu2N32G3YZaQ4Dx88bm5 wzdVJUA+IvX4vs7YvH+UDAZDS6Nv0DGRoJzCnajTR2Xe5hI7OSWfvU/bKoGKa24Y K8954Bqfn89/nFTdj8RM5/g= Received: (qmail 22777 invoked by alias); 6 Dec 2013 00:05:00 -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 22750 invoked by uid 89); 6 Dec 2013 00:05:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: mx01.qsc.de Received: from Unknown (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 06 Dec 2013 00:04:59 +0000 Received: from archimedes.net-b.de (port-92-194-51-180.dynamic.qsc.de [92.194.51.180]) by mx01.qsc.de (Postfix) with ESMTP id 193F8B1C2; Fri, 6 Dec 2013 01:04:50 +0100 (CET) Message-ID: <52A114A1.8010504@net-b.de> Date: Fri, 06 Dec 2013 01:04:49 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: gcc patches Subject: PR c++/58567: Fix ICE on invalid code with -fopenmp in cp/pt.c A rather simple fix for an ICE on invalid bug (low-priority 4.8/4.9 regression). Bootstrapped and regtested without new failure on x86-64-gnu-linux. OK for the trunk and 4.8? Tobias 2013-06-12 Tobias Burnus PR c++/58567 * pt.c (tsubst_omp_for_iterator): Early return for error_mark_node. 2013-06-12 Tobias Burnus PR c++/58567 * g++.dg/gomp/pr58567.C: New. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 25d940c..ddc7112 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13035,6 +13035,10 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, init_decl = (init && TREE_CODE (init) == DECL_EXPR); init = RECUR (init); decl = RECUR (decl); + + if (decl == error_mark_node) + return; + if (init_decl) { gcc_assert (!processing_template_decl); diff --git a/gcc/testsuite/g++.dg/gomp/pr58567.C b/gcc/testsuite/g++.dg/gomp/pr58567.C new file mode 100644 index 0000000..35a5bb0 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr58567.C @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +/* PR c++/58567 - was ICEing before */ + +template void foo() +{ + #pragma omp parallel for + for (typename T::X i = 0; i < 100; ++i) /* { dg-error "'int' is not a class, struct, or union type|expected iteration declaration or initialization" } */ + ; +} + +void bar() +{ + foo(); +}