NetBSD Problem Report #60103
From www@netbsd.org Thu Mar 19 04:09:42 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "R12" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 0BF8F1A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 19 Mar 2026 04:09:42 +0000 (UTC)
Message-Id: <20260319040941.395AE1A923A@mollari.NetBSD.org>
Date: Thu, 19 Mar 2026 04:09:41 +0000 (UTC)
From: pyhirricturtle@gmail.com
Reply-To: pyhirricturtle@gmail.com
To: gnats-bugs@NetBSD.org
Subject: vax libc __longjmp14 substitutes -1 instead of 1 when val==0
X-Send-Pr-Version: www-1.0
X-From4GNATS: "pyhirricturtle@gmail.com via gnats" <gnats-admin@NetBSD.org>
>Number: 60103
>Category: port-vax
>Synopsis: vax libc __longjmp14 substitutes -1 instead of 1 when val==0
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: port-vax-maintainer
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 19 04:10:00 +0000 2026
>Closed-Date:
>Last-Modified: Thu Mar 19 04:31:25 +0000 2026
>Originator: FireTurtle
>Release: 10.1_STABLE
>Organization:
>Environment:
NetBSD 10.1_STABLE (GENERIC) vax on SIMH MicroVAX 3900
>Description:
In lib/libc/arch/vax/gen/__longjmp14.c, when longjmp is called with
val==0, POSIX requires setjmp to return 1. The VAX implementation
substitutes -1 instead:
if (val == 0)
val = -1;
Every other architecture in the tree correctly uses val = 1.
Checked: alpha, hppa, m68k, mips, sparc64 -- all use val = 1.
This is a typo dating back to the original implementation.
>How-To-Repeat:
Call longjmp(env, 0) and observe that setjmp returns -1 instead of 1.
Alternatively, compare lib/libc/arch/vax/gen/__longjmp14.c line 61
against the same file in any other architecture.
>Fix:
In lib/libc/arch/vax/gen/__longjmp14.c, change:
if (val == 0)
val = -1;
to:
if (val == 0)
val = 1;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 19 Mar 2026 04:31:25 +0000
State-Changed-Why:
needs pullup-10, pullup-9
https://mail-index.netbsd.org/source-changes/2024/06/29/msg151988.html
Module Name: src
Committed By: rin
Date: Sat Jun 29 06:52:34 UTC 2024
Modified Files:
src/lib/libc/arch/vax/gen: __longjmp14.c _setjmp.S
Log Message:
vax: {,_}longjmp(3): Return 1 if `val` == 0
Found by tests/lib/libc/setjmp/t_setjmp:{,_}longjmp_zero.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/vax/gen/__longjmp14.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/vax/gen/_setjmp.S
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.