https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124554
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #3)
> Indeed, it seems as if this is a gcn/nvptx newlib problem. Looking at
> std.ii, there is:
>
> extern "C" {
> void longjmp (jmp_buf __jmpb, int __retval) __attribute__((__noreturn__));
> int setjmp (jmp_buf __jmpb) __attribute__((__returns_twice__));
> }
>
> without anything interesting before. 'jmp_buf' not being declared seems to
> be the main issue, even if I don't understand the 'void' issue.
The "void issue" is just what g++ prints when it thinks a declaration is for a
variable not a function. It doesn't what jmp_buf is, so it thinks you're
declaring a variable called "longjmp" of type void, which is invalid.
The problem is simply that jmp_buf is not defined.
Maybe nothing in the libstdc++ build ever tried to include <csetjmp> before, so
the fact it's broken on this target wasn't noticed.
We can add a configure check for a working setjmp.h and then make the contents
of <csetjmp> check a new autoconf macro.