bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making _Noreturn a no-op in < Clang 16?


From: Sam James
Subject: Re: Making _Noreturn a no-op in < Clang 16?
Date: Thu, 19 Jan 2023 20:44:51 +0000


> 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: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]