Segmentation Fault in sdf2table for mac OSX
I’m generating SDF and sometimes the grammar can get quite big (1000-2000 lines).
Usually there’s no problem, but I found some examples where sdf2table fails to produce a tbl and returns “Segmentation Fault”.
If I run the exact same input on windows or linux, it works.Here is the input grammar. It’s quite big (560 lines), but if I try to remove one more line, it works again. It may be that an array was initialized with a static value…
————–TEST START———————–
module Test exports context-free priorities { right: "~Int" Int -> Int {right, cons("Int168Syn")} } > { left: Int "^Int" Int -> Int {left, cons("Int169Syn")} } > { left: Int "*Int" Int -> Int {left, cons("Int170Syn")} Int "/Int" Int -> Int {left, cons("Int172Syn")} Int "%Int" Int -> Int {left, cons("Int173Syn")} Int "divInt" Int -> Int {left, cons("Int174Syn")} Int "modInt" Int -> Int {left, cons("Int175Syn")} } > { left: Int "+Int" Int -> Int {left, cons("Int1PlusSyn")} Int "-Int" Int -> Int {left, cons("Int176Syn")} } > { left: Int ">>Int" Int -> Int {left, cons("Int177Syn")} Int "< Int {left, cons("Int178Syn")} } > { left: Int "&Int" Int -> Int {left, cons("Int179Syn")} } > { left: Int "xorInt" Int -> Int {left, cons("Int180Syn")} } > { left: Int "|Int" Int -> Int {left, cons("Int182Syn")} } context-free priorities { Float "^Float" Float -> Float {left, cons("Float198Syn")} } > { left: Float "*Float" Float -> Float {left, cons("Float199Syn")} Float "/Float" Float -> Float {left, cons("Float1200Syn")} Float "%Float" Float -> Float {left, cons("Float1202Syn")} } > { left: Float "+Float" Float -> Float {left, cons("Float1203Syn")} Float "-Float" Float -> Float {left, cons("Float1204Syn")} } context-free priorities { left: Float "<=Float" Float -> Bool {left, cons("Bool1205Syn")} Float " Bool {left, cons("Bool1206Syn")} Float ">=Float" Float -> Bool {left, cons("Bool1207Syn")} Float ">Float" Float -> Bool {left, cons("Bool1208Syn")} Float "==Float" Float -> Bool {left, cons("Bool1209Syn")} Float "=/=Float" Float -> Bool {left, cons("Bool1220Syn")} } context-free priorities { K "==K" K -> Bool {cons("Bool1325Syn")} K "=/=K" K -> Bool {cons("Bool1326Syn")} } > { "notBool" Bool -> Bool {left, cons("Bool158Syn")} Bool "impliesBool" Bool -> Bool {left, cons("Bool165Syn")} Bool "andThenBool" Bool -> Bool {left, cons("Bool160Syn")} Bool "orBool" Bool -> Bool {left, cons("Bool163Syn")} Bool "xorBool" Bool -> Bool {left, cons("Bool162Syn")} Bool "orElseBool" Bool -> Bool {left, cons("Bool164Syn")} Bool "andBool" Bool -> Bool {left, cons("Bool159Syn")} } %% subsorts 1 context-free priorities { AssignedVariables -> K CapitalizedId -> K Array -> K QualifiedProcedureName -> K TCPAnswer -> K DzFloat -> K DzString -> K RelationFunctor -> K ValueTerm -> K Int -> K QualifiedRelationName -> K Aggregate -> K DzBool -> K Pid -> K FactDdef -> K Variable -> K RelationDdefinitionFunctor -> K Terms -> K Char -> K DdefinitionNamedPrecedence -> K ProcedureDdef -> K BuiltinRelationName -> K Term -> K String -> K QueryResults -> K Id -> K TermPairs -> K NamedPrecedence -> K QueryResult -> K RelationDdef -> K TempQueryDdef -> K Bool -> K QueryPairs -> K DzId -> K Query -> K Statement -> K Procedure -> K GroundFactSchema -> K RelativeOrdering -> K DzInt -> K Precedence -> K Atom -> K BaseTerm -> K ConstSym -> K ProcStatus -> K Ddefinitions -> K CompleteRelationDdefinitionFunctor -> K TermGroup -> K Float -> K FactSchema -> K Nat -> K RelationName -> K RelativePrecedence -> K Mgu -> K MguError -> K QueryTerm -> K Status -> K RelationDdefinitionHead -> K QueryWhere -> K UnqualifiedRelationName -> K IntOrVar -> K ProcedureName -> K Var -> K Ddefinition -> K } .> { ValueTerm -> Term Atom -> UnqualifiedRelationName String -> TCPAnswer BaseTerm -> ValueTerm String -> UnqualifiedRelationName DzFloat -> Float Atom -> ProcedureName Variable -> Var CompleteRelationDdefinitionFunctor -> RelationDdefinitionFunctor QueryTerm -> Statement String -> DdefinitionNamedPrecedence Term -> Terms Terms -> QueryWhere DdefinitionNamedPrecedence -> NamedPrecedence NamedPrecedence -> Precedence DzId -> Id ProcedureDdef -> Ddefinition RelationDdefinitionFunctor -> RelationDdefinitionHead Var -> IntOrVar GroundFactSchema -> Term FactSchema -> Terms DzString -> String Int -> DdefinitionNamedPrecedence QualifiedRelationName -> RelationName QueryTerm -> Query Aggregate -> Term UnqualifiedRelationName -> RelationName Nat -> Pid Ddefinition -> Ddefinitions RelativePrecedence -> Precedence RelationFunctor -> Term FactDdef -> Ddefinition DzBool -> Bool QualifiedProcedureName -> ProcedureName IntOrVar -> BaseTerm Atom -> BaseTerm RelationFunctor -> RelationDdefinitionFunctor Id -> Variable RelationDdef -> Ddefinition BuiltinRelationName -> UnqualifiedRelationName FactDdef -> Statement Bool -> BaseTerm DzInt -> Int ValueTerm -> FactSchema TermGroup -> Term TempQueryDdef -> Ddefinition Statement -> Procedure Int -> IntOrVar } .> { K -> AssignedVariables K -> CapitalizedId K -> Array K -> QualifiedProcedureName K -> TCPAnswer K -> DzFloat K -> DzString K -> RelationFunctor K -> ValueTerm K -> Int K -> QualifiedRelationName K -> Aggregate K -> DzBool K -> Pid K -> FactDdef K -> Variable K -> RelationDdefinitionFunctor K -> Terms K -> Char K -> DdefinitionNamedPrecedence K -> ProcedureDdef K -> BuiltinRelationName K -> Term K -> String K -> QueryResults K -> Id K -> TermPairs K -> NamedPrecedence K -> QueryResult K -> RelationDdef K -> TempQueryDdef K -> Bool K -> QueryPairs K -> DzId K -> Query K -> Statement K -> Procedure K -> GroundFactSchema K -> RelativeOrdering K -> DzInt K -> Precedence K -> Atom K -> BaseTerm K -> ConstSym K -> ProcStatus K -> Ddefinitions K -> CompleteRelationDdefinitionFunctor K -> TermGroup K -> Float K -> FactSchema K -> Nat K -> RelationName K -> RelativePrecedence K -> Mgu K -> MguError K -> QueryTerm K -> Status K -> RelationDdefinitionHead K -> QueryWhere K -> UnqualifiedRelationName K -> IntOrVar K -> ProcedureName K -> Var K -> Ddefinition } %% subsorts 1a context-free priorities { AssignedVariables -> K CapitalizedId -> K Array -> K QualifiedProcedureName -> K TCPAnswer -> K DzFloat -> K DzString -> K RelationFunctor -> K ValueTerm -> K Int -> K QualifiedRelationName -> K Aggregate -> K DzBool -> K Pid -> K FactDdef -> K Variable -> K RelationDdefinitionFunctor -> K Terms -> K Char -> K DdefinitionNamedPrecedence -> K ProcedureDdef -> K BuiltinRelationName -> K Term -> K String -> K QueryResults -> K Id -> K TermPairs -> K NamedPrecedence -> K QueryResult -> K RelationDdef -> K TempQueryDdef -> K Bool -> K QueryPairs -> K DzId -> K Query -> K Statement -> K Procedure -> K GroundFactSchema -> K RelativeOrdering -> K DzInt -> K Precedence -> K Atom -> K BaseTerm -> K ConstSym -> K ProcStatus -> K Ddefinitions -> K CompleteRelationDdefinitionFunctor -> K TermGroup -> K Float -> K FactSchema -> K Nat -> K RelationName -> K RelativePrecedence -> K Mgu -> K MguError -> K QueryTerm -> K Status -> K RelationDdefinitionHead -> K QueryWhere -> K UnqualifiedRelationName -> K IntOrVar -> K ProcedureName -> K Var -> K Ddefinition -> K } .> { K -> AssignedVariables K -> CapitalizedId K -> Array K -> QualifiedProcedureName K -> TCPAnswer K -> DzFloat K -> DzString K -> RelationFunctor K -> ValueTerm K -> Int K -> QualifiedRelationName K -> Aggregate K -> DzBool K -> Pid K -> FactDdef K -> Variable K -> RelationDdefinitionFunctor K -> Terms K -> Char K -> DdefinitionNamedPrecedence K -> ProcedureDdef K -> BuiltinRelationName K -> Term K -> String K -> QueryResults K -> Id K -> TermPairs K -> NamedPrecedence K -> QueryResult K -> RelationDdef K -> TempQueryDdef K -> Bool K -> QueryPairs K -> DzId K -> Query K -> Statement K -> Procedure K -> GroundFactSchema K -> RelativeOrdering K -> DzInt K -> Precedence K -> Atom K -> BaseTerm K -> ConstSym K -> ProcStatus K -> Ddefinitions K -> CompleteRelationDdefinitionFunctor K -> TermGroup K -> Float K -> FactSchema K -> Nat K -> RelationName K -> RelativePrecedence K -> Mgu K -> MguError K -> QueryTerm K -> Status K -> RelationDdefinitionHead K -> QueryWhere K -> UnqualifiedRelationName K -> IntOrVar K -> ProcedureName K -> Var K -> Ddefinition } %% subsorts 2 context-free priorities { K -> AssignedVariables K -> CapitalizedId K -> Array K -> QualifiedProcedureName K -> TCPAnswer K -> DzFloat K -> DzString K -> RelationFunctor K -> ValueTerm K -> Int K -> QualifiedRelationName K -> Aggregate K -> DzBool K -> Pid K -> FactDdef K -> Variable K -> RelationDdefinitionFunctor K -> Terms K -> Char K -> DdefinitionNamedPrecedence K -> ProcedureDdef K -> BuiltinRelationName K -> Term K -> String K -> QueryResults K -> Id K -> TermPairs K -> NamedPrecedence K -> QueryResult K -> RelationDdef K -> TempQueryDdef K -> Bool K -> QueryPairs K -> DzId K -> Query K -> Statement K -> Procedure K -> GroundFactSchema K -> RelativeOrdering K -> DzInt K -> Precedence K -> Atom K -> BaseTerm K -> ConstSym K -> ProcStatus K -> Ddefinitions K -> CompleteRelationDdefinitionFunctor K -> TermGroup K -> Float K -> FactSchema K -> Nat K -> RelationName K -> RelativePrecedence K -> Mgu K -> MguError K -> QueryTerm K -> Status K -> RelationDdefinitionHead K -> QueryWhere K -> UnqualifiedRelationName K -> IntOrVar K -> ProcedureName K -> Var K -> Ddefinition } .> { AssignedVariables -> K CapitalizedId -> K Array -> K QualifiedProcedureName -> K TCPAnswer -> K DzFloat -> K DzString -> K RelationFunctor -> K ValueTerm -> K Int -> K QualifiedRelationName -> K Aggregate -> K DzBool -> K Pid -> K FactDdef -> K Variable -> K RelationDdefinitionFunctor -> K Terms -> K Char -> K DdefinitionNamedPrecedence -> K ProcedureDdef -> K BuiltinRelationName -> K Term -> K String -> K QueryResults -> K Id -> K TermPairs -> K NamedPrecedence -> K QueryResult -> K RelationDdef -> K TempQueryDdef -> K Bool -> K QueryPairs -> K DzId -> K Query -> K Statement -> K Procedure -> K GroundFactSchema -> K RelativeOrdering -> K DzInt -> K Precedence -> K Atom -> K BaseTerm -> K ConstSym -> K ProcStatus -> K Ddefinitions -> K CompleteRelationDdefinitionFunctor -> K TermGroup -> K Float -> K FactSchema -> K Nat -> K RelationName -> K RelativePrecedence -> K Mgu -> K MguError -> K QueryTerm -> K Status -> K RelationDdefinitionHead -> K QueryWhere -> K UnqualifiedRelationName -> K IntOrVar -> K ProcedureName -> K Var -> K Ddefinition -> K } context-free priorities { ".K" -> K {cons("K12Empty"), prefer} "." -> K {cons("K1Empty")} K "~>" K -> K {left, cons("K1Seq")} ".List{K}" -> KList {cons("ListDlKDr12Empty")} ".KList" -> KList {cons("KList12Empty")} KList ",," KList -> KList {left, cons("KList1List")} } > { non-assoc: K "=>" K -> K {non-assoc, cons("K1Rewrite")} KList "=>" KList -> KList {non-assoc, cons("KList1Rewrite")} KLabel "=>" KLabel -> KLabel {cons("KLabel1Rewrite")} } context-free priorities { ".List" -> List {cons("List12Empty"), prefer} "." -> List {cons("List1Empty")} "ListItem" "(" K ")" -> ListItem {cons("ListItem1LIKItem")} ListItem -> List List List -> List {left, cons("List1List")} } > { List "=>" List -> List {non-assoc, cons("List1Rewrite")} } context-free priorities { ".Bag" -> Bag {cons("Bag12Empty"), prefer} "." -> Bag {cons("Bag1Empty")} BagItem -> Bag "BagItem" "(" K ")" -> BagItem {cons("BagItem1BIKItem")} %%BagItem+ -> Bag {cons("BagList")} Bag Bag -> Bag {left, cons("Bag1List")} } > { Bag "=>" Bag -> Bag {non-assoc, cons("Bag1Rewrite")} } context-free priorities { ".Set" -> Set {cons("Set12Empty"), prefer} "." -> Set {cons("Set1Empty")} "SetItem" "(" K ")" -> SetItem {cons("SetItem1SIKItem")} %%SetItem+ -> Set {cons("SetList")} SetItem -> Set %%{cons("Set3SetItem")} Set Set -> Set {left, cons("Set1List")} } > { Set "=>" Set -> Set {non-assoc, cons("Set1Rewrite")} }------------------TEST END------------------Submitted by Radu Mereuta on 1 April 2013 at 12:06
Issue Log
Hi Radu.
Let’s hope this is a stack limit issue. Try increasing the stack size by
ulimit -s 64000
. If this still doesn’t help, try to use thesdf2table
included in Spoofax, somewhere at
ECLIPSE_INSTALL_DIR/plugins/rg.strategoxt.imp.nativebundle_0.1.1.*/native/macosx/sdf2table. If still doesn’t fix your issue either, we really need to look for something else.
Using ulimit did the trick. Thanks. You can close the issue now.
Converted into question https://yellowgrass.org/question/Spoofax/21.
Log in to post comments