NetBSD Problem Report #58228

From www@netbsd.org  Mon May  6 17:25:16 2024
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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 020E71A9238
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  6 May 2024 17:25:16 +0000 (UTC)
Message-Id: <20240506172514.E6A941A923B@mollari.NetBSD.org>
Date: Mon,  6 May 2024 17:25:14 +0000 (UTC)
From: thorpej@me.com
Reply-To: thorpej@me.com
To: gnats-bugs@NetBSD.org
Subject: <fenv.h> is not supported on VAX
X-Send-Pr-Version: www-1.0

>Number:         58228
>Category:       port-vax
>Synopsis:       <fenv.h> is not supported on VAX
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thorpej
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 06 17:30:01 +0000 2024
>Last-Modified:  Tue May 07 03:37:12 +0000 2024
>Originator:     Jason Thorpe
>Release:        NetBSD 10
>Organization:
Just the BASICs
>Environment:
NetBSD vax3900 10.0_RC1 NetBSD 10.0_RC1 (GENERIC) #0: Wed Nov 29 12:36:24 UTC 2023  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/vax/compile/GENERIC vax
>Description:
Imagine my immense sadness when building my Tiny-ish BASIC interpreter for NetBSD/vax, I was greeted with:

vax3900:thorpej 19$ make
../tbasm/tbasm -H tbvm_program.asm
parsed 384 instructions (128 labels, 218 references)
program size: 1115 bytes
cc -Os -g -Wall -Wformat   -c tbvm.c -o tbvm.o
In file included from tbvm.c:41:
/usr/include/fenv.h:34:4: error: #error "fenv.h is currently not supported for this architecture"
   34 | #  error "fenv.h is currently not supported for this architecture"
      |    ^~~~~
tbvm.c:42: warning: ignoring '#pragma STDC FENV_ACCESS' [-Wunknown-pragmas]
   42 | #pragma STDC FENV_ACCESS ON
      | 
tbvm.c: In function 'check_math_error':
tbvm.c:817:19: error: 'FE_UNDERFLOW' undeclared (first use in this function); did you mean 'UNDERFLOW'?
  817 |      fetestexcept(FE_UNDERFLOW|FE_OVERFLOW|FE_DIVBYZERO|FE_INVALID);
      |                   ^~~~~~~~~~~~
      |                   UNDERFLOW
tbvm.c:817:19: note: each undeclared identifier is reported only once for each function it appears in
tbvm.c:817:32: error: 'FE_OVERFLOW' undeclared (first use in this function); did you mean 'EOVERFLOW'?
  817 |      fetestexcept(FE_UNDERFLOW|FE_OVERFLOW|FE_DIVBYZERO|FE_INVALID);
      |                                ^~~~~~~~~~~
      |                                EOVERFLOW
tbvm.c:817:44: error: 'FE_DIVBYZERO' undeclared (first use in this function); did you mean 'FP_DIRTYZERO'?
  817 |      fetestexcept(FE_UNDERFLOW|FE_OVERFLOW|FE_DIVBYZERO|FE_INVALID);
      |                                            ^~~~~~~~~~~~
      |                                            FP_DIRTYZERO
tbvm.c:817:57: error: 'FE_INVALID' undeclared (first use in this function); did you mean 'EINVAL'?
  817 |      fetestexcept(FE_UNDERFLOW|FE_OVERFLOW|FE_DIVBYZERO|FE_INVALID);
      |                                                         ^~~~~~~~~~
      |                                                         EINVAL
tbvm.c:823:16: error: 'FE_ALL_EXCEPT' undeclared (first use in this function)
  823 |  feclearexcept(FE_ALL_EXCEPT);
      |                ^~~~~~~~~~~~~
tbvm.c: In function 'tbvm_runprog':
tbvm.c:4097:16: error: 'FE_ALL_EXCEPT' undeclared (first use in this function)
 4097 |  feclearexcept(FE_ALL_EXCEPT);
      |                ^~~~~~~~~~~~~
*** Error code 1

Stop.
make: stopped in /home/thorpej/JTTB/tbvm
vax3900:thorpej 20$ 

>How-To-Repeat:
Try to use <fenv.h> to detect arithmetic exceptions.  I'm sure there are test programs already in the ATF test suite.
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-vax-maintainer->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Tue, 07 May 2024 03:37:12 +0000
Responsible-Changed-Why:
I have some ideas how to emulate these (given the lack of an architectural
register for it), so maybe I'll take a crack at it.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.