From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 49E423858D1E; Thu, 22 Dec 2022 17:10:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49E423858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671729034; bh=h4PHx8GKY0soYd4xrxxywmSyC3bDUdg/nMKA3as2dLM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OOp63ZZI6b2Afu4QYczf6OmBaO5t3MXrYoP7W4MjWssjwdqFla8Eq9Wd8QI5uMKRM NKh+u5hwxjFUlEf664ugnOFWmIYjVBHHhsVQ5V2voGgEYVxcIW8mLSKx7fza0saIsF tkgVxR5QdzBNC1e+uL4SwQr0pbD7StvQsXjaDNRU= From: "pskocik at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108194] GCC won't treat two compatible function types as compatible if any of them (or both of them) is declared _Noreturn Date: Thu, 22 Dec 2022 17:10:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pskocik at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108194 --- Comment #6 from Petr Skocik --- (In reply to Petr Skocik from comment #5) > (In reply to Andrew Pinski from comment #4) > > Invalid as mentioned in r13-3135-gfa258f6894801a . >=20 > I believe it's still a bug for pre-c2x __typeof. > While it is GCC's prerogative to include _Noreturn/__attribute((noreturn)) > into the type for its own __typeof (which, BTW, I think is better design > than the standardized semantics), I think two otherwise compatible functi= on > types should still remain compatible if they both either have or don't ha= ve > _Noreturn/__attribute((noreturn)). But treating `_Noreturn void > NR_FN_A(void);`=20 > as INcompatible with `_Noreturn void NR_FN_B(void);` that's just wonky, I= MO. OK, the bug was MINE after all. For bug report archeologists: I was doing what was meant to be a full (qualifers-including) type comparison wrong. While something like _Generic((__typeof(type0)*)0, __typeof(type1)*:1, default:0) suffices to get around _Generic dropping qualifs (const/volatile/_Atomic) in its controlling expression, for function pointer types at single pointer layer of indirecti= on, the _Noreturn attribute will still get dropped in the controlling expressio= n of _Generic (I guess that makes sense because they're much more closely relate= d to functions that how another pointer type would be related to its target type) and another pointer layer of indirection if required as in `_Generic((__typeof(type0)**)0, __typeof(type1)**:1, default:0)`. Thanks you all very much, especially joseph@codesourcery.com, who pointed me (pun intended) to the right solution over email. :)=