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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |10.0, 7.3.0, 8.2.0, 9.2.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirming with GCC 10.  The attribute is accepted and has the expected
effect in the middle-end but not in the C++ front-end.

$ cat pr81692.C && gcc -O2 -S -Wall -Wextra -Wpedantic
-fdump-tree-optimized=/dev/stdout pr81692.C 
template <class E>
__attribute__ ((noreturn))
void throw_exception (const char*);

template <class E>
int foo (int *p)
{
  throw_exception<E>(__PRETTY_FUNCTION__);
  *p = 0;   // eliminated
}

template int foo<int>(int*);
pr81692.C: In function ‘int foo(int*)’:
pr81692.C:10:1: warning: no return statement in function returning non-void
[-Wreturn-type]
   10 | }
      | ^

;; Function foo<int> (_Z3fooIiEiPi, funcdef_no=1, decl_uid=2339, cgraph_uid=1,
symbol_order=0)

foo<int> (int * p)
{
  <bb 2> [local count: 1073741824]:
  throw_exception<int> ("int foo(int*) [with E = int]");

}

Reply via email to