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 E3E713858CD1 for ; Tue, 9 Apr 2024 07:11:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3E713858CD1 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 E3E713858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712646687; cv=none; b=eU13kFT8xPF53GI8kkaHxjrghq7/fFA6SLvyPRDVDtwDK9/rGh/Mqcv0kh+KRjG5tHBDwYtuWtzJ4DeDtNbIvJUoEd2eDA+STe6yVtK31pinE0TI9ip0v+w5Q+whEEPnWeSwX/xgkLoS82jg+3BiaMyBf6OphFEBIyv8FMOtYSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712646687; c=relaxed/simple; bh=F3w2/zQGTrQH1fVbYFRmRkr8B4z5JD/JQxARI8sZ6j8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=qP6u7S3PX6LWrWRvyGLamfFK264yfYbMrJUOmJ0Mjq76w2HBxQgybR4ztOUrr/o8qiGre7BPoAQsCfMhAX1z4azM4OhZVz4fI9LIdkAwFEfcA4b3LIBc2sOEVGBIAOU7CpEEPriqd6eHSSgUa+K4/VTNhep7sBo5PjFexOg3W0A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712646685; h=from:from:reply-to: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=g0A7C1CmPmsDbOZNIshutCN7o3rSmockCOuAIUU6eVU=; b=MRMizbJsvCd1HUOiJEVaPxozcYPIAv0ApGQW/SIRrmocbhnHLAj5ZAchXArwwNMqb6GF9a iOui+XYtlzcWXf5okcyjS5JfS4zkIea2b8F6DfQqS4LyPt2VDFm12Oq8AoVqtbxNBZw+t+ yNsxfzrLxEBMif0VivcCBheHAkOVgv8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-HWYUGZYQPEiuh_SrEzv3Jw-1; Tue, 09 Apr 2024 03:11:21 -0400 X-MC-Unique: HWYUGZYQPEiuh_SrEzv3Jw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B2543800086; Tue, 9 Apr 2024 07:11:21 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C7902166B31; Tue, 9 Apr 2024 07:11:20 +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 4397BFY61299066 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 9 Apr 2024 09:11:15 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 4397BF2Q1299065; Tue, 9 Apr 2024 09:11:15 +0200 Date: Tue, 9 Apr 2024 09:11:14 +0200 From: Jakub Jelinek To: Richard Biener Cc: Jeff Law , Iain Sandoe , Jason Merrill , GCC Patches Subject: Re: [PATCH/RFC] On the use of -funreachable-traps to deal with PR 109627 Message-ID: Reply-To: Jakub Jelinek References: <56A9A5FB-8294-47CB-A6C4-22FD5561C71A@googlemail.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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=-4.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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, Apr 09, 2024 at 09:03:59AM +0200, Richard Biener wrote: > > With the possibility of sounding like a broken record, I think > > __builtin_unreachable is fundamentally flawed. It generates no code > > and just lets the program continue if ever "reached". This is a > > security risk and (IMHO) just plain silly. We're in a situation that is > > never supposed to happen, so continuing to execute code is just asking > > for problems. > > > > If it were up to me, I'd have __builtin_unreachable emit a trap or > > similar construct that should (in general) halt execution. > > __builtin_unreachable tells the compiler it's OK to omit a path to it > while __builtin_trap doesn't. So once we replace the former with the > latter we have to keep the path. Maybe that's OK. I do agree that > the RTL representation of expanding __builtin_unreachable () to > "nothing" is bad. Expanding to a trap always would be OK with me. Even that would prevent tons of needed optimizations, especially the reason why __builtin_unreachable () has been added in the first place - for asm goto which always branches and so the kernel can put __builtin_unreachable () after it to say that it won't fall through. I think the kernel folks would be upset if we change that. So, can't we instead just emit a trap when in the last cfglayout -> cfgrtl switch we see that the last bb in the function doesn't have any successors? Jakub