From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E8583385703A for ; Wed, 30 Nov 2022 15:51:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E8583385703A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669823478; 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:in-reply-to:in-reply-to: references:references; bh=j9UHUOOHFX8g574T74Ta+/kvxxCkEbW7ARoOY0Er+9M=; b=fmzZyhuQwgDEJhws+XCvA7YlOQprV9u7txZ1w0uzQCJw2VjPjsAGWxMH9PBPpAXUTwtUFX a4g9NPlidxH0zwr6Q2szsOocmn8yvJhNWB0g3i29WP13DYXxROQMQtLt17+Sh+4uqFGa5+ JGfNXQzhOYiD3ykZQexfhFWC9iTIQQk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-0hlV334IPSGalsoWb6_XVw-1; Wed, 30 Nov 2022 10:51:16 -0500 X-MC-Unique: 0hlV334IPSGalsoWb6_XVw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 74317185A78B for ; Wed, 30 Nov 2022 15:51:16 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3383C2024CC0; Wed, 30 Nov 2022 15:51:15 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AUFpBMw1868633 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 30 Nov 2022 16:51:11 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AUFpAhR1868632; Wed, 30 Nov 2022 16:51:10 +0100 Date: Wed, 30 Nov 2022 16:51:10 +0100 From: Jakub Jelinek To: Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c++: Incremental fix for g++.dg/gomp/for-21.C [PR84469] Message-ID: Reply-To: Jakub Jelinek References: <029221ef-74ce-12a4-29f9-599bf4efaa20@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Nov 29, 2022 at 11:05:33PM +0100, Jakub Jelinek wrote: > On Tue, Nov 29, 2022 at 04:38:50PM -0500, Jason Merrill wrote: > > > --- gcc/testsuite/g++.dg/gomp/for-21.C.jj 2020-01-12 11:54:37.178401867 +0100 > > > +++ gcc/testsuite/g++.dg/gomp/for-21.C 2022-11-29 13:06:59.038410557 +0100 > > > @@ -54,9 +54,9 @@ void > > > f6 (S (&a)[10]) > > > { > > > #pragma omp for collapse (2) > > > - for (auto [i, j, k] : a) // { dg-error "use of 'i' before deduction of 'auto'" "" { target *-*-* } .-1 } > > > + for (auto [i, j, k] : a) // { dg-error "use of 'i' before deduction of 'auto'" } > > > for (int l = i; l < j; l += k) // { dg-error "use of 'j' before deduction of 'auto'" } > > > - ; // { dg-error "use of 'k' before deduction of 'auto'" "" { target *-*-* } .-3 } > > > + ; // { dg-error "use of 'k' before deduction of 'auto'" "" { target *-*-* } .-1 } > > > > Hmm, this error is surprising: since the initializer is non-dependent, we > > should have deduced immediately. I'd expect the same error as in the > > non-structured-binding cases, "* expression refers to iteration variable". > > The reason was just to be consistent what is (unfortunately) emitted > in the other cases (!processing_template_decl or type dependent). > I guess I could try how much work would it be to deduce it sooner, but > generally it is pretty corner case, people rarely do this in OpenMP code. I had a look at that today, but it would be pretty hard. The thing is we must emit all the associated code for all the range for loops in OpenMP loops at a different spot. So, the only possibility I see would be if we during parsing of a range for loop inside of the OpenMP loop nest we don't do the cp_finish_omp_range_for stuff to avoid e.g. cp_finish_decl, but instead build_x_indirect_ref (input_location, begin, RO_UNARY_STAR, NULL_TREE, tf_none) and if that gives a non-dependent type, temporarily overwrite TREE_TYPE of the decl and if it is structured binding, temporarily ++processing_template_decl and cp_finish_decomp, then after parsing all the associated loop headers we revert that (and ditto for instantiation of OpenMP loops). Jakub