<div dir="ltr">Hi,<div><br></div><div>There&#39;s no obvious cause of this in my code so I wonder what you make of it.</div><div><br></div><div>Background: my library is for parsing Starlark code (that&#39;s the language Bazel uses). I&#39;m using the object &quot;applicator&quot; capability to support predicates and pseudo attributes, so I can do things like:</div><div><br></div><div>(node :&lt;nodetype&gt;?)</div><div><br></div><div>which returns true if the AST node has that type. E.g.  (node :list-expr?)</div><div><br></div><div>An example of a pseudo attribute is (node :@deps), which when applied to a node of type :call-expr (that is, a Bazel rule application), reaches down into the subnodes to get the &quot;deps&quot; attribute.  The Bazel code would look like:</div><div><br></div><div>cc_library(</div><div>    name = &quot;foobar&quot;,</div><div>    deps  = [&quot;:baz&quot;]</div><div>)</div><div><br></div><div>So when applied to the cc_library node, it would return the nodelist for &quot;deps = [&quot;:baz&quot;]&quot;.</div><div><br></div><div>It&#39;s been working great so far (just getting started) but I&#39;ve run into the following problem.  This works, returning true for the test node:</div><div><br></div><div>  (display (format #f &quot;(node :stmt-list?): ~A&quot; (node :stmt-list?)))<br></div><div><br></div><div>However, if I run it a second time, it fails.  The problem is that s7_keyword_to_symbol strips the trailing question mark - but only the second time thru!</div><div><br></div><div>Here&#39;s a fragment from my code:</div><div><br></div><div>    s7_pointer op = s7_car(rest);  /* op is the kw :stmt-list? */<br>    if (s7_is_keyword(op)) {<br>        log_debug(&quot;KWdump: %s&quot;, s7_object_to_c_string(s7, op));<br>        s7_pointer sym = s7_keyword_to_symbol(s7, op);<br>        log_debug(&quot;SYMdump: %s&quot;, s7_object_to_c_string(s7, sym));<br>        char *kw = (char*)s7_symbol_name(sym);<br>        log_debug(&quot;KW: %s&quot;, kw);<br></div><div>        ... handle kw ...</div><div>      ....</div><div><br></div><div>When I eval this:</div><div><br></div><div>  (display (format #f &quot;(node :stmt-list?): ~A&quot; (node :stmt-list?))) (newline)<br>  (display (format #f &quot;(node :stmt-list?): ~A&quot; (node :stmt-list?))) (newline)<br></div><div><br></div><div>This is the log output:</div><div><br></div><div>ast_node_s7.c:445: g_ast_node_object_applicator<br>ast_node_s7.c:1329: APPLICATOR ARGS:<br>ast_node_s7.c:1330:         (:stmt-list?)<br>ast_node_s7.c:459: KWdump: :stmt-list?<br>ast_node_s7.c:461: SYMdump: stmt-list?   &lt;&lt;=========== ? retained<br>ast_node_s7.c:463: KW: stmt-list?<br>ast_node_s7.c:479: KW PREDICATE stmt-list?<br>ast_node_s7.c:338: ast_node_type_kw_pred: stmt-list?<br>nodes.c:317: lookup: TK-Stmt-List<br>(node :stmt-list?): #t<br>ast_node_s7.c:445: g_ast_node_object_applicator<br>ast_node_s7.c:1329: APPLICATOR ARGS:<br>ast_node_s7.c:1330:         (:stmt-list?)<br>ast_node_s7.c:459: KWdump: :stmt-list?<br>ast_node_s7.c:461: SYMdump: stmt-list          &lt;&lt;======= ? disappeared<br>ast_node_s7.c:463: KW: stmt-list<br>ast_node_s7.c:385: g_ast_node_ref_specialized<br>ast_node_s7.c:289: ast_node_property_lookup<br><br>;ast-node-ref argument 1, :stmt-list?, is a symbol but should be one of :c, :str, :i, etc.<br><br></div><div>(The error is correct since the actual lookup is based on stmt-list not stmt-list?)</div><div><br></div><div>It looks to me like it might be a bug in s7, but I would not be surprised if my code has managed to corrupt the memory somehow.  Any help would be appreciated.</div><div><br></div><div>Gregg</div><div><div></div></div></div>