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 556373858C2D for ; Wed, 30 Mar 2022 14:23:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 556373858C2D Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-Qr7Edzg-OvWEzRzZ3ZyKYw-1; Wed, 30 Mar 2022 10:23:00 -0400 X-MC-Unique: Qr7Edzg-OvWEzRzZ3ZyKYw-1 Received: by mail-qt1-f198.google.com with SMTP id z18-20020ac84552000000b002e201c79cd4so17542880qtn.2 for ; Wed, 30 Mar 2022 07:23:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8YDFQou3WZ6uxOE/O7q7rte4oizLCQlKMDHyoaY4vaw=; b=OVnbDoJsSi72IAgrdlZo/53QIBionydzH4U0DURCf80P/qFjaMR6ipsMg/fngeJKQm Q0bVD3YazYMWitAUSZXlIAG/LxBc//wuSHjeMHOQ/g56Ix35Hsf8APW9kl9lft8W3FcB e5rOxRLyvUmMbY2862RVS2Y3aeIw5AtB05y6XExsVKv7sGw2SVvrTWZwonqcMlqClMj9 rs8S+p2AE5T1bPEt1GMfPJFXiCt3e/UuUng62xZVfh3YSGo8O40urvSlSvm7I9m1H6KP Teuple9355aTKqRdYteUCmDCGe3oa2I+zJmrxC9tygGwwYiz/rEWrbu2DyGKi25qfzwy B3hw== X-Gm-Message-State: AOAM531a7ODiN4YXt3bPvkwRJzvIPpU8FEdTvZNk44Irha14s0jtlCeo WStrXCCmzXciCKV3k1z1ayPlSHKE8SCCjOTlf6sIKiGXiGf5haTAVv6/lRtcykqJIh9jneyQ9DK MB4xNfhEERHQZi/BNEg== X-Received: by 2002:a05:6214:10e8:b0:42c:6e7:c7d2 with SMTP id q8-20020a05621410e800b0042c06e7c7d2mr31981694qvt.56.1648650180283; Wed, 30 Mar 2022 07:23:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdkKvWbedd6+vsfVuq2U6FmRga57Xb2Z3ut10WTrh8PPcOD2m6OBsBMKaGzIV3uYyU27A+2A== X-Received: by 2002:a05:6214:10e8:b0:42c:6e7:c7d2 with SMTP id q8-20020a05621410e800b0042c06e7c7d2mr31981666qvt.56.1648650179989; Wed, 30 Mar 2022 07:22:59 -0700 (PDT) Received: from redhat.com ([2601:184:4780:4310::5f2c]) by smtp.gmail.com with ESMTPSA id d12-20020a05620a158c00b00648ec3fcbdfsm10566558qkk.72.2022.03.30.07.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 07:22:59 -0700 (PDT) Date: Wed, 30 Mar 2022 10:22:57 -0400 From: Marek Polacek To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH] c-family: ICE with -Wconversion and A ?: B [PR101030] Message-ID: References: <20220329205321.90251-1-polacek@redhat.com> <12d83e36-46a2-221c-4535-11025376bfd6@redhat.com> MIME-Version: 1.0 In-Reply-To: <12d83e36-46a2-221c-4535-11025376bfd6@redhat.com> User-Agent: Mutt/2.1.5 (2021-12-30) 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=-7.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2022 14:23:07 -0000 On Tue, Mar 29, 2022 at 10:21:47PM -0400, Jason Merrill wrote: > On 3/29/22 16:53, Marek Polacek wrote: > > This patch fixes a crash in conversion_warning on a null expression. > > It is null because the testcase uses the GNU A ?: B extension. We > > could also use op0 instead of op1 in this case, but it doesn't seem > > to be necessary. > > I wonder why we don't represent the extension as > > SAVE_EXPR(A) ? SAVE_EXPR(A) : B > > so we don't hit this sort of problem. But the patch is OK. The reason there are no SAVE_EXPRs is that we don't create them in a template: cp_save_expr: /* There is no reason to create a SAVE_EXPR within a template; if needed, we can create the SAVE_EXPR when instantiating the template. Furthermore, the middle-end cannot handle C++-specific tree codes. */ if (processing_template_decl) return expr; and when instantiating we see the first expression is tree_invariant_p_1 aka constant, so no SAVE_EXPR gets created. Patch pushed, thanks. Marek