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.129.124]) by sourceware.org (Postfix) with ESMTPS id 30AA83858D1E for ; Wed, 30 Nov 2022 18:52:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30AA83858D1E 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=1669834333; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=ccDirjnJgYb2BGz/Jmm8VVLgRvK19dgcxFm0zNvgBHE=; b=ZtwpnYpxhJ4Jb/FrNQ1rAU46SDfxy0azjynFIADPg4r6i9vrpBlAR41Y6gkUL2M2QkbLlw +ta9JPtSLv2daHQjCPwFi2JoKRz0Sy9llTvTUFUI0WgYJf6A/c76VdC+aiSmhGmwOwznDu M9cUJ+Wyd2BAccBxDqmJKEV+EQB/Jnw= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-669-qRjKXJQmPEuhz60DNPZjlg-1; Wed, 30 Nov 2022 13:52:11 -0500 X-MC-Unique: qRjKXJQmPEuhz60DNPZjlg-1 Received: by mail-qt1-f200.google.com with SMTP id cj6-20020a05622a258600b003a519d02f59so29906994qtb.5 for ; Wed, 30 Nov 2022 10:52:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ccDirjnJgYb2BGz/Jmm8VVLgRvK19dgcxFm0zNvgBHE=; b=MGut2QSUemO4XhMagWbx1fQZI3XpMt+BdbTu4wEjGK7ynH/AfR/Y+KnVKmYqsukaNJ Vnv4hDvUyABxC90Y1QHi4L5U0pcbzi24fc+wEJQJDktixMi3K2lNLQX8syNJ3JKbENAg gZgtjxfkx+v/1bCTek49jquttl1vg8VsSjbAJgZMySWdaThrxvjnwLXUX+ETRqdBIbcQ bUsl7278UOhgMc14UOR2d6iUXlR4yGKUlsL8SX33ZJ7ad4OFUlM/qDoQ9MB1+JiiL6kO Z7v1fH20RNH3guQ66iOUldiCX2mueZ+E5bFNEFYfC46Oym0RO8KEn6KqGOOPEsEiilII 3g6A== X-Gm-Message-State: ANoB5pndGvLomVpZrKj6/btNLPvkqBe7ZWdsTJqNubW1xDhUi/GQ1sLR Qug/+gDZ2jax6rsFq29j9I2KqZGu/2+HanCKxTZYrPwkEGnMHjTNMbq38dFzA8vjwMwcwJ1c02l ZxSf5KTBZA2ea4hVsSQ== X-Received: by 2002:a05:622a:5c8b:b0:3a5:b02:a3b7 with SMTP id ge11-20020a05622a5c8b00b003a50b02a3b7mr42245404qtb.277.1669834329563; Wed, 30 Nov 2022 10:52:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tjx4OjGyUwszz19m39B8iETTM8n6yJdNeMwGC0QrCToiMRJzjz6Siaf8wWwh5gTV+AeKwFA== X-Received: by 2002:a05:622a:5c8b:b0:3a5:b02:a3b7 with SMTP id ge11-20020a05622a5c8b00b003a50b02a3b7mr42245385qtb.277.1669834329233; Wed, 30 Nov 2022 10:52:09 -0800 (PST) Received: from [192.168.1.108] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id f10-20020a05622a1a0a00b00399ad646794sm1362220qtb.41.2022.11.30.10.52.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Nov 2022 10:52:08 -0800 (PST) Message-ID: Date: Wed, 30 Nov 2022 13:52:08 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] c++: Incremental fix for g++.dg/gomp/for-21.C [PR84469] To: Jakub Jelinek , gcc-patches@gcc.gnu.org References: <029221ef-74ce-12a4-29f9-599bf4efaa20@redhat.com> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 11/30/22 10:51, Jakub Jelinek wrote: > 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). It looks like we're already deducing the type for the underlying S variable in cp_convert_omp_range_for, we just aren't updating the types of the individual bindings. Jason