[LLVMbugs] [Bug 10338] __attribute__((noreturn)) not matching functions in clang++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 12 07:40:17 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10338

Douglas Gregor <dgregor at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Douglas Gregor <dgregor at apple.com> 2011-07-12 09:40:17 CDT ---
Clang is actually behaving correctly here. It is unsafe to pass a pointer to a
function that my return to a parameter that expects a 'noreturn' function
pointer, since the callee could have been optimized on the assumption that
calling that function pointer won't return. GCC doesn't actually enforce these
type-safety constraints on noreturn function pointers.

The fix is relatively simple: explicitly cast from the function pointer type to
the 'noreturn' function pointer type, e.g.,

  if (setjmp ((*png_set_longjmp_fn((png_ptr), (png_longjmp_ptr)longjmp, sizeof
(jmp_buf)))))

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list