Weird Bugs in Patternist

September 21, 2006

Compiler bugs has a tendency to be amazingly weird. Consider this query:

 

declare function local:main()

{

let $a := 1

let $b := 1

return 1

};

 

declare function local:foo($c, $d, $e)

{

1

};

 

declare function local:bar($f, $g, $h)

{

 

};

 

declare function local:car($i, $j)

{

1

};

 

declare function local:moo($k)

{

$k

};

 

local:moo(1)

It crashes with:

[virtual Patternist::PlainSharedPtr<Patternist::Expression> Patternist::DefaultDynamicContext::expressionVariable(Patternist::VariableSlotID) const] slot: 10
Fatal error: ASSERT: “m_ptr” in file ../../kdom/patternist/utils/PlainSharedPtr.h, line 103

 

So, it most likely is related to variable binding.

 

The weird thing is that I can’t make the test case any simpler. No function arguments can be removed, no functions, no unused variable declarations. No matter what I remove, the crash disappears.

 

One might now say: “Frans, Frans, Frans. Do you think anyone cares about your pathethic debugging adventures?” No, I don’t, but please let me cry out my despair!

 

One Response to “Weird Bugs in Patternist”

  1. davidbdale Says:

    Cry, code debugger, cry!
    Cry, code debugger, cry!
    Nobody begins to understand.
    Nobody cares to understand.
    Your anguish over misplaced colons
    buttresses our world.
    Without you, we are in the crapper.
    When the lights go out, and the power goes down, and we huddle hopelessly in our dark, cold, isolated clammy caves of ignorance . . . and we pray for a brain superior to ours that can re-connect us to the energy grid,
    You are The Clapper.

    (I can’t feel your pain. But I appreciate your pain.)


Leave a Reply