SciML / SciML/RuntimeGeneratedFunctions.jl

Segfault when RGF is called with wrong number of arguments

Open
#100 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Julia
Stars
112
Forks
19
Avg merge
6h 11m
Merged PRs (30d)
9

Description

Describe the bug 🐞
A RGF segfaults if called with the wrong number of arguments:

Expected behavior

Ideally a normal runtime exception.

Minimal Reproducible Example 👇

using Pkg
pkg"activate --temp"
pkg"add RuntimeGeneratedFunctions"

using RuntimeGeneratedFunctions
RuntimeGeneratedFunctions.init(@__MODULE__)

ex = :(function f(x, t)
        x[1]
    end)
f = @RuntimeGeneratedFunction(ex)
f([1.0]) # segfault💣 
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 9 8945HS w/ Radeon 780M Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 16 default, 0 interactive, 8 GC (on 16 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
  JULIA_PKG_PRESERVE_TIERED_INSTALLED = true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided RuntimeGeneratedFunctions reproducer with Julia 1.11.5, focusing on initialization through RuntimeGeneratedFunctions.init and the @RuntimeGeneratedFunction call. The work is done when calling the generated function with the wrong number of arguments raises a normal runtime exception instead of segfaulting.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.