linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k <linux-m68k@lists.linux-m68k.org>
Subject: Re: [PATCH] asm-generic: bug.h: add unreachable() in BUG() for CONFIG_BUG not set
Date: Sun, 17 Oct 2021 12:17:32 -0700	[thread overview]
Message-ID: <8aad5fd2-6850-800a-3c56-199bb5d4f4ae@infradead.org> (raw)
In-Reply-To: <CAK8P3a3XDY5gMUA3h3tVmQuxSHn_J3qOw_rDurzBx-KFdGhCKA@mail.gmail.com>

On 10/17/21 12:09 PM, Arnd Bergmann wrote:
> On Sun, Oct 17, 2021 at 7:49 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>> When CONFIG_BUG is not set/enabled, there is a warning
>> on ARCH=m68k, gcc version 11.1.0-nolibc from Arnd's crosstools:
>>
>> ../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]
>>
>> Adding "unreachable()" in the BUG() macro silences the warning.
> 
> No, I don't think this is the right solution:
> 
>> -#define BUG() do {} while (1)
>> +#define BUG() do {unreachable();} while (1)
> 
> Marking this code unreachable() means the compiler is free
> to assume any code path leading here will never be entered,
> which leads to additional undefined behavior and other warnings
> rather than just hanging reproducibly.
> 
> The endless loop here should normally be sufficient to tell the
> compiler that the function never returns, so it sounds like a
> problem in gcc for m68k.

Sounds likely.

> Did you see any other issues like this one on m68k, or the
> same one on another architecture?

No and no.

thanks.
-- 
~Randy

  reply	other threads:[~2021-10-17 19:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-17 17:49 [PATCH] asm-generic: bug.h: add unreachable() in BUG() for CONFIG_BUG not set Randy Dunlap
2021-10-17 19:09 ` Arnd Bergmann
2021-10-17 19:17   ` Randy Dunlap [this message]
2021-10-17 19:24     ` Arnd Bergmann
2021-10-17 19:27       ` Randy Dunlap
2021-10-17 19:38         ` Arnd Bergmann
2021-10-17 20:16           ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8aad5fd2-6850-800a-3c56-199bb5d4f4ae@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=arnd@arndb.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).