This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/71876] longjmp is miscompiled with -ffreestanding
- From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 16 Jul 2016 07:51:06 +0000
- Subject: [Bug middle-end/71876] longjmp is miscompiled with -ffreestanding
- Auto-submitted: auto-generated
- References: <bug-71876-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71876
--- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 38915
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38915&action=edit
possible patch
This is an attempt of a fix.
Not really perfect, but should be at least safe.
Only ECF_RETURN_TWICE is considered to be safe in general.
Except for possible Wclobber warnings, and bad optimization
of course, if for instance "getcontext" does not do what
we think it does.
If a built-in is defined, it can add the ECF_LEAF and/or
ECF_NORETURN, but only if no -ansi or -ffreestanding is
in effect.
I think the special handling of "setjmp_syscall",
"savectx", and "qsetjmp", as well as the prefix
"__x" are there since r201, and can be removed now.