public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108194] New: GCC won't treat two compatible function types as compatible if any of them (or both of them) is declared _Noreturn
@ 2022-12-21 11:03 pskocik at gmail dot com
  2022-12-21 13:03 ` [Bug c/108194] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pskocik at gmail dot com @ 2022-12-21 11:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108194

            Bug ID: 108194
           Summary: GCC won't treat two compatible function types as
                    compatible if any of them (or both of them) is
                    declared _Noreturn
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pskocik at gmail dot com
  Target Milestone: ---

(same with __attribute((noreturn))) Example (https://godbolt.org/z/ePGd95sWz):


void FN_A(void);
void FN_B(void);
_Noreturn void NR_FN_A(void);
_Noreturn void NR_FN_B(void);

_Static_assert(_Generic((__typeof(*(FN_A))*){0}, __typeof(*(FN_B))*: 1), "");
//OK ✓
_Static_assert(_Generic((__typeof(*(NR_FN_A))*){0}, __typeof(*(NR_FN_B))*: 1),
""); //ERROR ✗
_Static_assert(_Generic((__typeof(*(FN_A))*){0}, __typeof(*(NR_FN_B))*: 1),
""); //ERROR ✗

As you can see from the Compiler Explorer link, clang accepts all three, which
is as it should be as per the standard, where _Noreturn is a function specifier
(https://port70.net/~nsz/c/c11/n1570.html#6.7.4), which means it shouldn't even
go into the type.

(Personally, I don't even mind it going into the type just as long as two
otherwise identical _Noreturn functio declarations are deemed as having the
same type).

Regards,
Petr Skocik

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-22 17:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21 11:03 [Bug c/108194] New: GCC won't treat two compatible function types as compatible if any of them (or both of them) is declared _Noreturn pskocik at gmail dot com
2022-12-21 13:03 ` [Bug c/108194] " rguenth at gcc dot gnu.org
2022-12-21 13:25 ` pinskia at gcc dot gnu.org
2022-12-21 17:27 ` joseph at codesourcery dot com
2022-12-21 17:36 ` pinskia at gcc dot gnu.org
2022-12-21 17:48 ` pskocik at gmail dot com
2022-12-22 17:10 ` pskocik at gmail dot com

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).