Skip to content

warning on riscv64 #321

Open
Open
@inkydragon

Description

@inkydragon

Moved from #278 (comment)

There's the same warning on riscv64:

In file included from /home/runner/work/openlibm/openlibm/include/openlibm_fenv.h:18,
                 from src/s_lrint.c:29:
In function ‘feupdateenv’,
    inlined from ‘lrint’ at src/s_lrint.c:59:2:
/home/runner/work/openlibm/openlibm/include/openlibm_fenv_riscv.h:87:25: warning: ‘env’ is used uninitialized [-Wuninitialized]
   87 | #define __wfs(__fcsr)   __asm __volatile("csrw fcsr, %0" :: "r" (__fcsr))
      |                         ^~~~~
/home/runner/work/openlibm/openlibm/include/openlibm_fenv_riscv.h:213:9: note: in expansion of macro ‘__wfs’
  213 |         __wfs(*__envp);
      |         ^~~~~
src/s_lrint.c: In function ‘lrint’:
src/s_lrint.c:52:16: note: ‘env’ was declared here
   52 |         fenv_t env;
      |                ^~~

This also makes Julia crash on riscv64 during bootstrap after the update of openlibm to v0.8.4 with the following error message

$ make -j3
[...]
    JULIA usr/lib/julia/sys-o.a
Collecting and executing precompile statements
└ Collect (Basic: ✓ fatal: error thrown and no exception handler available.
BoundsError(a=Array{Base.Partr.taskheap, 1}(dims=(0,), mem=Memory{Base.Partr.taskheap}(0, 0x3f848c0a60)[]), i=(0,))
throw_boundserror at ./essentials.jl:15
getindex at ./essentials.jl:916 [inlined]
getindex at ./abstractarray.jl:1345 [inlined]
multiq_insert at ./partr.jl:152
enq_work at ./task.jl:972
#schedule#589 at ./task.jl:1040
schedule at ./task.jl:1027 [inlined]
notify at ./condition.jl:165
#notify#552 at ./condition.jl:159 [inlined]
notify at ./condition.jl:159 [inlined]
notify at ./condition.jl:159 [inlined]
task_done_hook at ./task.jl:823
unknown function (ip: 0x3f7e650957) at (unknown file)
jl_apply at /home/mose/repo/julia/src/julia.h:2246 [inlined]
jl_finish_task at /home/mose/repo/julia/src/task.c:345
start_task at /home/mose/repo/julia/src/task.c:1292
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [sysimage.mk:99: /home/mose/repo/julia/usr/lib/julia/sys-o.a] Error 1
make: *** [Makefile:120: julia-sysimg-release] Error 2
Command exited with non-zero status 2

On that commit, Julia uses fgetenv/fsetenv inside the task scheduler, which matches the stacktrace. However the use of fenv was removed a few days afterwards, but this still looks to me like a strong indication that the fenv code on riscv64 is bad.

CC: @xctan who introduced this code in #254

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions