This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/71876] longjmp is miscompiled with -ffreestanding


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]