Date: Thu, 22 Apr 2021 08:21:17 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 255320] Wrong setjmp return value in FreeBSD 13 (at least on aarch64) Message-ID: <bug-255320-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255320 Bug ID: 255320 Summary: Wrong setjmp return value in FreeBSD 13 (at least on aarch64) Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: pkk@spth.de I noticed some programs failing on my Raspi 4 on FreeBSD 13, and tracked the issue down to setjmp behaviour. Apparently setjmp returns 0 when it should return 1. The FreeBSD man page for setjmp / longjmp does _not_ state that setjmp should return 1 on a longjmp with argument 0. But it states that the functions are conforming to the ISO C90 standard. All C standards, including ISO C90 mandate that setjmp should return 1 on a longjmp with argument 0. I don't know if this is an issue specific to aarch64, or just some generic FreeBSD issue, as the Raspi is my only FreeBSD system. I created a small test program to reproduce the issue; it fails on the Raspi, but passes on Debian GNU/Linux on amd64: I compile using cc test.c, execute via ./a.out. #include <setjmp.h> #include <assert.h> jmp_buf buf; void g(void) { // When called with an argument of 0, longjmp() should make setjmp() return 1 instead. longjmp(buf, 0); g(); } void f1(void) { static int i; int j; i = 0; j = setjmp(buf); assert(i == j); i++; if(!j) g(); } int main(void) { f1(); return 0; } -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-255320-227>
