NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-vax/60103: vax libc __longjmp14 substitutes -1 instead of 1 when val==0



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 19 04:10:00 +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;




Home | Main Index | Thread Index | Old Index