public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/31022] New: feupdateenv (FE_DFL_ENV) crashes on riscv
@ 2023-11-01 17:02 bruno at clisp dot org
  2023-11-01 17:03 ` [Bug math/31022] " bruno at clisp dot org
  2023-12-19 18:38 ` adhemerval.zanella at linaro dot org
  0 siblings, 2 replies; 3+ messages in thread
From: bruno at clisp dot org @ 2023-11-01 17:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31022

            Bug ID: 31022
           Summary: feupdateenv (FE_DFL_ENV) crashes on riscv
           Product: glibc
           Version: 2.37
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: bruno at clisp dot org
  Target Milestone: ---

ISO C 23 § 7.6.6.4 says about feupdateenv:
"The argument envp shall point to an object set by a call to feholdexcept or
fegetenv, or equal a dynamic floating-point environment macro."

This means, it is valid to call feupdateenv (FE_DFL_ENV).

But this call crashes with SIGSEGV on riscv.

How to reproduce:
========================== foo.c ======================
#include <fenv.h>

int
main ()
{
  return feupdateenv (FE_DFL_ENV) != 0;
}
=======================================================
$ gcc -Wall foo.c -lm
$ ./a.out
Segmentation fault (core dumped)

The place where it crashes is obviously at
glibc/sysdeps/riscv/rvf/fenv_private.h line 126:

static __always_inline void
libc_feupdateenv_riscv (const fenv_t *envp)
{
  _FPU_SETCW (*envp | riscv_getflags ());   // <================ HERE
}

with envp being 0xffffffffffffffff.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug math/31022] feupdateenv (FE_DFL_ENV) crashes on riscv
  2023-11-01 17:02 [Bug math/31022] New: feupdateenv (FE_DFL_ENV) crashes on riscv bruno at clisp dot org
@ 2023-11-01 17:03 ` bruno at clisp dot org
  2023-12-19 18:38 ` adhemerval.zanella at linaro dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bruno at clisp dot org @ 2023-11-01 17:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31022

Bruno Haible <bruno at clisp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|                            |riscv64-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug math/31022] feupdateenv (FE_DFL_ENV) crashes on riscv
  2023-11-01 17:02 [Bug math/31022] New: feupdateenv (FE_DFL_ENV) crashes on riscv bruno at clisp dot org
  2023-11-01 17:03 ` [Bug math/31022] " bruno at clisp dot org
@ 2023-12-19 18:38 ` adhemerval.zanella at linaro dot org
  1 sibling, 0 replies; 3+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-12-19 18:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31022

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.39
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.39 (802aef27b2d9f04b06344706f88d37bbe89629e9).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-19 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01 17:02 [Bug math/31022] New: feupdateenv (FE_DFL_ENV) crashes on riscv bruno at clisp dot org
2023-11-01 17:03 ` [Bug math/31022] " bruno at clisp dot org
2023-12-19 18:38 ` adhemerval.zanella at linaro dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).