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 80BE03858D37 for ; Tue, 19 Mar 2024 19:47:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80BE03858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 80BE03858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710877669; cv=none; b=mswAkdcopS4YsnggYftCbYGQsG+JDUBsknfH9tI9ECCHZi0F6Uaw4XSyUaFE6S45J7xITTl0K/Z3oLzez+TzB2o1HWRVLwFnpH9iyp73xRBaAzw5Rk0r/IYy6JTBCV0BW/QV6LJLWJ3+iPM1WsI8VOuJT4GJTJFFO5EJ8BS8bVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710877669; c=relaxed/simple; bh=k561+US61xoaaWXtsgHj8e89kbYaWP9OveKl0ciaULY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=I7/Z3E1YFD89vTwAePv8cUbOBvfEcEzh5FKTsS3SpyUY+NGtwPETjf/4M2TK8NCAX5ZhSvbw5Dd1e27ovWw8qNVGse0Bwb/r8Q5WKyU3mDfZxa4X5T+n6kOGBV6IKpc6G2KI+0FO32ZAnIyb03lHVcaqRPupjpkXrvtmYEkZxYA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710877659; 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: in-reply-to:in-reply-to:references:references; bh=cY0hAdEhC1gi6eQ1UvGD39G2s5meroR72tmotyiuzUI=; b=LgKq++hJn0j7DCRBW2QRguo/gO9cJblc5CpvKcLiuof0TJW6XjaASmRYLBT1/OsjqpNq6j gMYjY7gBdkq+x0SNecgIF3b5XU9rP62kwio2hGCOT1+bUsE1dm/Hv5jrRwwgVqYpx2EgcR iQzwutGfwpOkFisXpoTsuuLtixjz4+0= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-489-Bhp2YirjOjG52w_OIukXAA-1; Tue, 19 Mar 2024 15:47:37 -0400 X-MC-Unique: Bhp2YirjOjG52w_OIukXAA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6962767b1f8so30271306d6.3 for ; Tue, 19 Mar 2024 12:47:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710877657; x=1711482457; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cY0hAdEhC1gi6eQ1UvGD39G2s5meroR72tmotyiuzUI=; b=lmYC6slYQWuARQlptJUXIPgnFuRgdwd1kBj8ng8PTn6/TurJSai9u4A+1G3JSka2Mi mhzFTd4FECPaYdQ/m0M+Qr/IatCQRN4XVVGed1wF/ntiPscngFUExZPnbHzdht5h/Yo3 k+ZIadmVSf4Rjeran2CMjWMzmKTuuiSxnXQPtHbHh//fnZcWe52cIX/hcITdsQ7NUaVQ uZamNgcAmuDnaF19OGk6Uk27AldamZbu2V3V06fZNVpo3ZRQ2AOUd95bQGTRff5vL2Wx NN2xRIv/g22PvoHvEzyMJAo1v2hdU7hIrKEf9+Xkcle69pKndVQa1ATjNiWuGEaiJRIO AOqQ== X-Gm-Message-State: AOJu0YxbMefQPFcjbGJ6VVxKJFIx+ODcBXJMV539HguFc8AZRDkuRKGW Gd+lscUNnYuGrdUoQ9+F3BxZjqtGmdkqJ3YPLXCA/I5K6rc91SlFBYlqexwKAjOVCNo5jqjQn+V 0DB5GN9qCC7grq7TP0E6cs71sDYwZgeWE58+3c4vrwKpzTLZ59HRS+Mw= X-Received: by 2002:a0c:e78f:0:b0:691:4a94:697f with SMTP id x15-20020a0ce78f000000b006914a94697fmr3540011qvn.27.1710877657302; Tue, 19 Mar 2024 12:47:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1He3xxi9gsQkMxHwzJey7gyKgO7kYyOvTSoR+3P/qiI/IrdR9c4nNhZVtiinK2sQHyMolNQ== X-Received: by 2002:a0c:e78f:0:b0:691:4a94:697f with SMTP id x15-20020a0ce78f000000b006914a94697fmr3539999qvn.27.1710877657020; Tue, 19 Mar 2024 12:47:37 -0700 (PDT) Received: from redhat.com (2603-7000-9500-34a5-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:34a5::1db4]) by smtp.gmail.com with ESMTPSA id p14-20020a05621421ee00b00691631154a2sm6492385qvj.43.2024.03.19.12.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 12:47:36 -0700 (PDT) Date: Tue, 19 Mar 2024 15:47:35 -0400 From: Marek Polacek To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH v3] c++: ICE with temporary of class type in array DMI [PR109966] Message-ID: References: <20240311232758.458729-1-polacek@redhat.com> <2244ac04-8bb6-4030-85c6-7a10aa20c494@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) 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=-6.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_H4,RCVD_IN_MSPIKE_WL,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 Thu, Mar 14, 2024 at 05:26:59PM -0400, Marek Polacek wrote: > @@ -1441,11 +1406,13 @@ static tree > replace_placeholders_for_class_temp_r (tree *tp, int *, void *data) > { > tree t = *tp; > - tree full_expr = *static_cast(data); > + auto pset = static_cast *>(data); > > /* We're looking for a TARGET_EXPR nested in the whole expression. */ > if (TREE_CODE (t) == TARGET_EXPR > - && !potential_prvalue_result_of (t, full_expr)) > + /* That serves as temporary materialization, not an initializer. */ > + && !TARGET_EXPR_ELIDING_P (t) > + && !pset->add (t)) > { > tree init = TARGET_EXPR_INITIAL (t); > while (TREE_CODE (init) == COMPOUND_EXPR) > @@ -1460,6 +1427,16 @@ replace_placeholders_for_class_temp_r (tree *tp, int *, void *data) > gcc_checking_assert (!find_placeholders (init)); > } > } > + /* TARGET_EXPRs initializing function arguments are not marked as eliding, > + even though gimplify_arg drops them on the floor. Don't go replacing > + placeholders in them. */ > + else if (TREE_CODE (t) == CALL_EXPR || TREE_CODE (t) == AGGR_INIT_EXPR) > + for (int i = 0; i < call_expr_nargs (t); ++i) > + { > + tree arg = get_nth_callarg (t, i); > + if (TREE_CODE (arg) == TARGET_EXPR) I just realized this could also check !TARGET_EXPR_ELIDING_P; there's no point to adding an eliding TARGET_EXPR into the pset. > + pset->add (arg); > + } Marek