bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: "Gnulib bugs" <bug-gnulib@gnu.org>, "Arsen Arsenović" <arsen@aarsen.me>
Subject: Re: Making _Noreturn a no-op in < Clang 16?
Date: Thu, 19 Jan 2023 20:44:51 +0000	[thread overview]
Message-ID: <B9404A70-AD4B-4F33-943D-8EEE7843AC2B@gentoo.org> (raw)
In-Reply-To: <575c1ae6-d77d-9001-9f9b-a803778446c6@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]



> On 19 Jan 2023, at 04:17, Paul Eggert <eggert@cs.ucla.edu> wrote:
> 
> The problem we found in Gawk was that this sort of function call:
> 
>    (b ? f : g) (x)
> 
> is mishandled by Clang < 16 when one function is _Noreturn and the other isn't, in that Clang mistakenly treats the call as if both functions are _Noreturn.
> 
> I expect this sort of issue to be reasonably rare in practical C code, as most people don't write code like the above, and when they do then typically F is _Noreturn if and only if G is also _Noreturn. So I've held off on doing the more-drastic "#define _Noreturn /*empty*/" for Clang < 16 in Gnulib, as my guess has been that the advantages of enabling _Noreturn on Clang < 16 are greater than the disadvantages given the rarity of situations like the above.
> 

I don't have any sort of statistics on this either. _Noreturn is pretty much just an optimisation (and I'm not convinced that it's _needed_ in a lot of cases, rather just a useful hint). I'd rather
a correct result than a quicker one. But then again, you could argue that given nobody noticed for at least 13 years (including with several Linux distros building gawk with Clang), it's
not a big deal in the wild.

(err() is noreturn anyway so I'd expect the compiler to be able to deduce it.)

Up to you. I think the conservative option is to do it, but if you feel uncertain, we can probably just leave the matter. Is there any precedent wrt
handling miscompilations for actively supported compilers in gnulib and such?

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]

  reply	other threads:[~2023-01-19 20:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  2:09 Making _Noreturn a no-op in < Clang 16? Sam James
2023-01-19  4:17 ` Paul Eggert
2023-01-19 20:44   ` Sam James [this message]
2023-01-19 21:20     ` Paul Eggert
2023-01-19 21:30       ` Sam James
2023-01-20  3:40         ` Paul Eggert
2023-01-20  4:20           ` Sam James
2023-01-20  9:16             ` Paul Eggert
2023-01-20 10:25               ` Bruno Haible

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=B9404A70-AD4B-4F33-943D-8EEE7843AC2B@gentoo.org \
    --to=sam@gentoo.org \
    --cc=arsen@aarsen.me \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).