Module Name:    src
Committed By:   riastradh
Date:           Sun Aug 25 18:31:30 UTC 2019

Modified Files:
        src/lib/libm/arch/aarch64: fenv.c

Log Message:
Fix fesetenv and feupdateenv.

- fesetenv is supposed to set the stored rounding mode (and stored trap
  settings, but they have no effect on any ARMv8 I know).

- feupdateenv is supposed to re-raise the exceptions that were raised
  in the environment when it was called.

XXX atf test
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/arch/aarch64/fenv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libm/arch/aarch64/fenv.c
diff -u src/lib/libm/arch/aarch64/fenv.c:1.4 src/lib/libm/arch/aarch64/fenv.c:1.5
--- src/lib/libm/arch/aarch64/fenv.c:1.4	Wed Nov  7 06:47:38 2018
+++ src/lib/libm/arch/aarch64/fenv.c	Sun Aug 25 18:31:30 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.4 2018/11/07 06:47:38 riastradh Exp $ */
+/* $NetBSD: fenv.c,v 1.5 2019/08/25 18:31:30 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.4 2018/11/07 06:47:38 riastradh Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.5 2019/08/25 18:31:30 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -213,6 +213,7 @@ int
 fesetenv(const fenv_t *envp)
 {
 	reg_fpsr_write(envp->__fpsr);
+	reg_fpcr_write(envp->__fpcr);
 	return 0;
 }
 
@@ -225,11 +226,10 @@ fesetenv(const fenv_t *envp)
 int
 feupdateenv(const fenv_t *envp)
 {
-#ifndef lint
-	_DIAGASSERT(envp != NULL);
-#endif
-	reg_fpsr_write(envp->__fpsr);
-	reg_fpcr_write(envp->__fpcr);
+	int except = fetestexcept(FE_ALL_EXCEPT);
+
+	fesetenv(envp);
+	feraiseexcept(except);
 
 	/* Success */
 	return 0;

Reply via email to