public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100068] New: inconsistent handling of noreturn on nested function declarations
@ 2021-04-13 18:47 msebor at gcc dot gnu.org
  2021-04-13 18:53 ` [Bug c/100068] " msebor at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-13 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100068
           Summary: inconsistent handling of noreturn on nested function
                    declarations
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

For the test case below, in f1() GCC (in both C and C++ modes) emits just one
call to g1() while Clang, ICC emit two.  Visual C gives an error for the
noreturn mismatch between the two declarations of g1().

In f0(), all compilers emit just one call to g0() (Visual C with optimization;
without optimization it warns about the second call to g0() being unreachable).

$ cat a.c && gcc -O -S -Wall -fdump-tree-optimized=/dev/stdout a.c

void f0 (void)
{
  extern __attribute__ ((noreturn)) int g0 (void);

  {
    extern int g0 (void);
  }

  g0 ();
  g0 ();   // eliminated by all tested compilers
}

void f1 (void)
{ 
  extern int g1 (void);

  {
    extern __attribute__ ((noreturn)) int g1 (void);
  }

  g1 ();
  g1 ();   // eliminated by GCC, emitted by Clang and ICC
} 


;; Function f0 (f0, funcdef_no=0, decl_uid=1943, cgraph_uid=1, symbol_order=0)
(executed once)

void f0 ()
{
  <bb 2> [local count: 1073741824]:
  g0 ();

}



;; Function f1 (f1, funcdef_no=1, decl_uid=1952, cgraph_uid=2, symbol_order=1)
(executed once)

void f1 ()
{
  <bb 2> [local count: 1073741824]:
  g1 ();

}

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

end of thread, other threads:[~2021-04-13 21:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 18:47 [Bug c/100068] New: inconsistent handling of noreturn on nested function declarations msebor at gcc dot gnu.org
2021-04-13 18:53 ` [Bug c/100068] " msebor at gcc dot gnu.org
2021-04-13 19:10 ` msebor at gcc dot gnu.org
2021-04-13 20:05 ` pinskia at gcc dot gnu.org
2021-04-13 21:43 ` msebor at gcc dot gnu.org

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