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 AFA85385773D for ; Tue, 2 May 2023 18:36:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFA85385773D 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=1683052579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JqAYzGJ3gnn5iVJiKvn207W2Ly9vGYTMs/KTQhTqBC4=; b=iCrSrvKn28e3ezvF3vIT3ra6itPPW6ZuFHR+EO4aerRtSFBLfPRHTQP8MTEjy/g3vjJnxa A2wYyoH2k5extGjzgRvChiP21U3Q3omvkRK923r8A1Tusb+k20X0EHOOl5dFQLSUyzLk5x xGXEy9emsYoE6JB8qYeaESED2HLEA48= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-l4yT-w2nN--2jCarVN6gdw-1; Tue, 02 May 2023 14:36:18 -0400 X-MC-Unique: l4yT-w2nN--2jCarVN6gdw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-751319bd93cso2354511785a.0 for ; Tue, 02 May 2023 11:36:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683052577; x=1685644577; h=content-transfer-encoding:in-reply-to:from:references:cc: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=JqAYzGJ3gnn5iVJiKvn207W2Ly9vGYTMs/KTQhTqBC4=; b=ZuJCQeqH43Hs200h+rFTX9WhkqYDGGAX37cpU5DgzaTU6DD4L2JS3AAKOKK2D5KhsE kxwd+BsSWFghjueBlL10W+9IAd0SlDAPXxzRHdw9Ivhh2h7SxfgpFuudBxHQr89+lilT iMDRqBvDXetXHY4sFX2gaAOZ+r5yenLmE1fueGiZsAO6PWYd/lDlc8KvgQSSHiwlY9+N NgxMffXwhfMJwOy136avHx6Y0UkL0A/d3HXPCygWXy01O/EiOh0yaMd7Qkv8YRkKRoR2 L6G0p2boq4rSSZiytK2H/WAjZhK9rjZ91YBsAvgIZYLxsVh+ILdQgK79SRa0RNeh3VQu Z+bA== X-Gm-Message-State: AC+VfDwJR6mTfqRv56r/VlBmxYf7bE65quxtxdIi21Gq1Y11mbFfh/yL GjSqLH45OO6ng3OfSeRhSJd0fd2qocnIGpJSj81/nJW3VM2K5+fM+cGtOBNajjbDTrqSA8KTasW jQYifkCk7JjXneFC1hw== X-Received: by 2002:a05:6214:1c8e:b0:5ee:e18d:3ec with SMTP id ib14-20020a0562141c8e00b005eee18d03ecmr5081839qvb.26.1683052577490; Tue, 02 May 2023 11:36:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xWw9RVBWT1NqBrW2eoO2L5WsKQQN2Kt4VSbMDIk+pup5G1nfiDjPfoT1VSKi36/GgLENORg== X-Received: by 2002:a05:6214:1c8e:b0:5ee:e18d:3ec with SMTP id ib14-20020a0562141c8e00b005eee18d03ecmr5081821qvb.26.1683052577187; Tue, 02 May 2023 11:36:17 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id c17-20020a0ce151000000b005ef5be4c2f7sm9727084qvl.73.2023.05.02.11.36.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 May 2023 11:36:16 -0700 (PDT) Message-ID: Date: Tue, 2 May 2023 14:36:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH] c++: Fix up VEC_INIT_EXPR gimplification after r12-7069 To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org, Patrick Palka References: 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=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 5/2/23 11:19, Jakub Jelinek wrote: > Hi! > > During patch backporting, I've noticed that while most cp_walk_tree calls > with cp_fold_r callback callers were changed from &pset to cp_fold_data > &data, the VEC_INIT_EXPR gimplifications has not, so it still passes just > address of a hash_set and so if during the folding we ever touch > data->flags, we use uninitialized data there. > > The following patch changes it to do the same thing as cp_fold_function > because the VEC_INIT_EXPR gimplifications will happen on function bodies > only. > > Ok for trunk if it passes bootstrap/regtest? OK. > 2023-05-02 Jakub Jelinek > > * cp-gimplify.cc (cp_fold_data): Move definition earlier. > (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false > constructed data rather than &pset to cp_walk_tree with cp_fold_r. > > --- gcc/cp/cp-gimplify.cc.jj 2023-03-16 22:01:02.295090975 +0100 > +++ gcc/cp/cp-gimplify.cc 2023-05-02 17:05:03.079652427 +0200 > @@ -57,6 +57,13 @@ enum fold_flags { > > using fold_flags_t = int; > > +struct cp_fold_data > +{ > + hash_set pset; > + fold_flags_t flags; > + cp_fold_data (fold_flags_t flags): flags (flags) {} > +}; > + > /* Forward declarations. */ > > static tree cp_genericize_r (tree *, int *, void *); > @@ -505,8 +512,8 @@ cp_gimplify_expr (tree *expr_p, gimple_s > *expr_p = expand_vec_init_expr (NULL_TREE, *expr_p, > tf_warning_or_error); > > - hash_set pset; > - cp_walk_tree (expr_p, cp_fold_r, &pset, NULL); > + cp_fold_data data (ff_genericize | ff_mce_false); > + cp_walk_tree (expr_p, cp_fold_r, &data, NULL); > cp_genericize_tree (expr_p, false); > copy_if_shared (expr_p); > ret = GS_OK; > @@ -1029,13 +1036,6 @@ struct cp_genericize_data > in fold-const, we need to perform this before transformation to > GIMPLE-form. */ > > -struct cp_fold_data > -{ > - hash_set pset; > - fold_flags_t flags; > - cp_fold_data (fold_flags_t flags): flags (flags) {} > -}; > - > static tree > cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_) > { > > Jakub >