Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 674
    • Issues 674
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPyPyPy
  • pypypypy
  • Issues
  • #3297
Closed
Open
Issue created Sep 09, 2020 by bjorn-martinsson@bjorn-martinsson

PyPy2 and PyPy3 segfaulting when running a simple Python program

This basic Python program will segfault when run in either PyPy2 or PyPy3.

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def main():
    n = 50
    a = list(range(1, n + 1))[::-1]

    f = [0] * n
    f[0] = 1
    g = a[0]

    for i in range(n):
        mx = 0
        pos = -1

        for i in range(n):
            if f[i] == 0:
                if gcd(g, a[i]) > mx:
                    mx = gcd(g, a[i])
                    pos = i
        g = gcd(g, a[pos])

main()

I've tested this locally on my Windows computers (running PyPy2 and PyPy3 7.3.1) and I've also had multiple friends try running it on their systems. It segfaults for everyone.

Worth noting is that adding the line pypyjit.set_param(threshold = 2) at the top will make it segfault for n = 3. So the segfault seems to be connected to the JIT.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking