From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5A903858417; Wed, 1 Nov 2023 17:02:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5A903858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1698858169; bh=2XChF9E1RN1s6rt4kiAZ9rjtR9FEV8kfH/TI3zdtuVk=; h=From:To:Subject:Date:From; b=KQZSKPxiO0kOiCHJknW6Xkv5WZpiFq3L6D3mRgNWqYyov59tQVQoxBKoxrldZ1t02 tnZDBLjkwooe4YmUvcOVGERw1TWot3zLgDpHKEPEo69ebGPBbcy9+0Jj8WHh4g9gov DoM9anCssc/th+q0FxzyI1PiI0mDiWNWG5BoQdb8= From: "bruno at clisp dot org" To: glibc-bugs@sourceware.org Subject: [Bug math/31022] New: feupdateenv (FE_DFL_ENV) crashes on riscv Date: Wed, 01 Nov 2023 17:02:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Version: 2.37 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bruno at clisp dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31022 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 =C2=A7 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D foo.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include int main () { return feupdateenv (FE_DFL_ENV) !=3D 0; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D $ 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 ()); // <=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D HERE } with envp being 0xffffffffffffffff. --=20 You are receiving this mail because: You are on the CC list for the bug.=