Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp67200pxj; Tue, 15 Jun 2021 20:17:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEb/1OxsKGawyB0nDjz0f2dsFXXG1Do+Y11l49Gn5XHKdFRu1cKTfJNK/KQ+XPhgL4rAOn X-Received: by 2002:aa7:dbc3:: with SMTP id v3mr1475710edt.63.1623813437602; Tue, 15 Jun 2021 20:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623813437; cv=none; d=google.com; s=arc-20160816; b=fSX/F/SAPc8rxPboTYYERuh3zDKA1DPWgny2TuhR4gRtQ8+Bdh9CSQgYLec+cPXHeX 1TO/n6HBENKbLCYiT+SwM0d1wEE2vd6xiJ87TUtR7935v0qmc5VSdLkNthokGCzMQtE4 ATbDr0VEKDfFtkmD1eHmzeJ6iTj7k07jcpPQ5imYXYnhnyUozXN1KajeAz9NViqxlzhU +T58/ZSSHe+a1lxPBocMoOTxbW7FPXq/4glMJC5qbpuP37VaDJn7ajN4DsNEYBgXBGEi r7lCPhHcXTIG81oxrSS12TaM41XS6pjd47W8kD4F9vxa5h4ip/zlzPCUfu8Cv1qvuHrL r2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=MURdV5QWwILBtHbRwg5FOKeDhIsQ2ZMeR3crNlYkz24=; b=BnQ/lXQSWzsmL7Ru/6GXlDIzfacJ7xxLfzZEJ/MM9q2sNvPsBotBdW65jhqUy8vT3p oIWehmqk7rWVLrIpd9+rdAZXgyVlKk1eE6+lIULehzWumiTiAF3kC/zDPuhjFlQtdWHg Samgu9zPIT0Xx+4JGZLElf3sewO+tqzKIHBdcU1yZ8QJvU5CGspdkGGwkVf8x5i8gHEF VflxGmSNULR/IGCb4nlXpgiLcSFblyma1p6eiVwR4rrS5v9TlCCXyhJl+9uQ6B7hbYPV p6F8YFrp9CEsx4/DmuP6zq+fwpHXrCgZiuG0M2eGtqauR1JibBMUeZhQQH1LXDEB1aub guTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si681635edd.408.2021.06.15.20.16.55; Tue, 15 Jun 2021 20:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbhFPDRe (ORCPT + 99 others); Tue, 15 Jun 2021 23:17:34 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:7444 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbhFPDRd (ORCPT ); Tue, 15 Jun 2021 23:17:33 -0400 Received: from dggeme751-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G4Vby745szZhkv; Wed, 16 Jun 2021 11:12:30 +0800 (CST) Received: from [10.174.177.253] (10.174.177.253) by dggeme751-chm.china.huawei.com (10.3.19.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 16 Jun 2021 11:15:25 +0800 Subject: Re: [PATCH] afs: fix no return statement in function returning non-void To: Randy Dunlap , Linus Torvalds CC: David Howells , Hulk Robot , Tom Rix , , Marc Dionne , linux-fsdevel , Linux Kernel Mailing List References: <162375813191.653958.11993495571264748407.stgit@warthog.procyon.org.uk> From: Zheng Zengkai Message-ID: <051421e0-afe8-c6ca-95cd-4dc8cd20a43e@huawei.com> Date: Wed, 16 Jun 2021 11:15:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.253] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme751-chm.china.huawei.com (10.3.19.97) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oops, Sorry for the late reply and missing the compilation details. > On 6/15/21 5:32 PM, Linus Torvalds wrote: >> On Tue, Jun 15, 2021 at 4:58 PM Randy Dunlap wrote: >>> Some implementations of BUG() are macros, not functions, >> Not "some", I think. Most. >> >>> so "unreachable" is not applicable AFAIK. >> Sure it is. One common pattern is the x86 one: >> >> #define BUG() \ >> do { \ >> instrumentation_begin(); \ >> _BUG_FLAGS(ASM_UD2, 0); \ >> unreachable(); \ >> } while (0) > duh. > >> and that "unreachable()" is exactly what I'm talking about. >> >> So I repeat: what completely broken compiler / config / architecture >> is it that needs that "return 0" after a BUG() statement? > I have seen it on ia64 -- most likely GCC 9.3.0, but I'll have to > double check that. Actually we build the kernel with the following compiler, config and architecture : powerpc64-linux-gnu-gcc --version powerpc64-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. CONFIG_AFS_FS=y # CONFIG_AFS_DEBUG is not set CONFIG_AFS_DEBUG_CURSOR=y make ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- -j64 ... fs/afs/dir.c: In function ‘afs_dir_set_page_dirty’: fs/afs/dir.c:51:1: error: no return statement in function returning non-void [-Werror=return-type]    51 | }       | ^ cc1: some warnings being treated as errors >> Because that environment is broken, and the warning is bogus and wrong. >> >> It might not be the compiler. It might be some architecture that does >> this wrong. It might be some very particular configuration that does >> something bad and makes the "unreachable()" not work (or not exist). >> >> But *that* is the bug that should be fixed. Not adding a pointless and >> incorrect line that makes no sense, just to hide the real bug. > . >