From patchwork Tue Nov 19 09:00:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1197302 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-513996-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.b="G3efDCyb"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="XYYZHRS2"; 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 47HKY81ptkz9sPW for ; Tue, 19 Nov 2019 20:00:44 +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=eErGpPMVqSztD+FL 9nVcp7IyRVoqAZq6KqGSaObHRw/C5Ga1gjburnkQl0kAXBs1NII5YjCHMuQW3JcZ 9YE5USiKVJPVoSNr36Nuc49k87VF8khzKxvS/muspGHTbBe+jsBsZsXrjWor8vjT 9m+Wz0IJTts6MjC3MsfGEc4lwhU= 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=1BINa+//S6XirD+hcnMJJq wngp8=; b=G3efDCybMYTOLGYvQCtQjAshefO4RB2j5VU6xUuXkXk5AHhrLa4iRn K5Pqu74rh0skDQGTRPSOJMvDukog7gp5h/a59VTTjBUlEu7fMllK2k8D16/2Rbi1 InvdXryd+bK/PEr0BtHEP+nOyM3wWQZSQDWTNG5CLajhTBzNcbHmA= Received: (qmail 96761 invoked by alias); 19 Nov 2019 09:00:33 -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 96628 invoked by uid 89); 19 Nov 2019 09:00:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 09:00:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574154021; 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=z8+NJe0zdSc8aU9uoiKPKKKvDCIPaP4vmm8cvzbId7Q=; b=XYYZHRS2ixr3+w4QbiD7p4R+Mgr+VadVMh8ije0kvIyyWqC9dNQtrDy6ecDael4GNscBWa d8/LDokH+KSBJo5TX9sWBBJOMnXUViPqVSPxXNh7BWnOsneEB0tC05jaBynMl0/7hE5TIn Ccu6Amky7IsSau9SguJ8yDbgZAwVSCo= 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-151-PTxPkDhMN3OD0cpbAtN5iA-1; Tue, 19 Nov 2019 04:00:19 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B22CB1883521 for ; Tue, 19 Nov 2019 09:00:18 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B6BA60251 for ; Tue, 19 Nov 2019 09:00:18 +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 xAJ90GvG019877 for ; Tue, 19 Nov 2019 10:00:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id xAJ90G6j019876 for gcc-patches@gcc.gnu.org; Tue, 19 Nov 2019 10:00:16 +0100 Date: Tue, 19 Nov 2019 10:00:16 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix ICE in handle_omp_class_iterator (PR c++/92504) Message-ID: <20191119090016.GD4650@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 Content-Disposition: inline X-IsSubscribed: yes Hi! Calling cp_fully_fold (which has been introduced with C++ late folding) before actually diagnosing invalid arguments of the comparison is problematic, because as the testcase shows the folding can then ICE before the invalid code is reported. Removing the cp_fully_fold call doesn't regress anything, so I've removed it after doing bootstrap/regtest on x86_64-linux and i686-linux and committed to trunk. 2019-11-19 Jakub Jelinek PR c++/92504 * semantics.c (handle_omp_for_class_iterator): Don't call cp_fully_fold on cond. * g++.dg/gomp/pr92504.C: New test. Jakub --- gcc/cp/semantics.c.jj 2019-11-11 21:04:24.837962966 +0100 +++ gcc/cp/semantics.c 2019-11-18 19:19:36.921680774 +0100 @@ -8434,7 +8434,6 @@ handle_omp_for_class_iterator (int i, lo if (init && EXPR_HAS_LOCATION (init)) elocus = EXPR_LOCATION (init); - cond = cp_fully_fold (cond); switch (TREE_CODE (cond)) { case GT_EXPR: --- gcc/testsuite/g++.dg/gomp/pr92504.C.jj 2019-11-18 19:18:45.211452647 +0100 +++ gcc/testsuite/g++.dg/gomp/pr92504.C 2019-11-18 19:19:19.660938426 +0100 @@ -0,0 +1,29 @@ +// PR c++/92504 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-O2" } + +namespace std { + typedef __SIZE_TYPE__ size_t; + typedef __PTRDIFF_TYPE__ ptrdiff_t; +} + +struct A { + A (); + A (const A &); + A & operator++ (); + bool operator != (const A &) const; + std::ptrdiff_t operator - (const A &); + A & operator += (std::size_t); + int a; + A & begin (); + A & end (); // { dg-message "declared here" } +}; + +void +bar () +{ + A a; + #pragma omp for + for (auto b = a; b != a.end; ++b) // { dg-error "invalid use of non-static member function" } + ; +}