Morpho-lang / Morpho-lang/morpho

[Bug] Internal consistency error: Incorrectly freed register in arg list

Open
#95 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug segfault/consistency error
Dominant language
C
Stars
153
Forks
22
Avg merge
9d 10h
Merged PRs (30d)
1

Description

Compiling the following gives a consistency error

import meshtools
import constants

fn mobius(r = 1, ratio = 0.5) {
    var L = 2*r*ratio // Separation
    var m = AreaMesh(fn(u,v) mobiusfn(u,v,r=r,ntwist=-1), -Pi..Pi:Pi/20,-L/2..L/2:L/10, closed=[false,false])
    return m
}
fn mobiusfn(u,v, r = 1, ntwist=1){
    var th = Matrix([cos(u), 0, sin(u)])
    var twist = (cos(0.5*ntwist*u)*th + sin(0.5*ntwist*u)*Matrix([0,1,0]))
    return r*th + v*twist
}

--Registers (7 in use)
r0 mobius [0]
r1 r [0] (captured)
r2 ratio [0]
r3 L [1]
r4 m [1]
r5 temporary [1]
r6 mobiusfn [1]
--End registers
Internal consistency error: Please contact developer. [Explanation: Incorrectly freed registers in compiling argument list.].

Reproduction script:
newconsitency.zip

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 newconsitency.zip reproduction script and tracing the compiler's argument-list handling when it reports incorrectly freed registers. Use the register dump and the failing Morpho example to identify the affected path. Done means the example compiles without the internal consistency error and register tracking remains consistent.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.