The "graph" binary segfaults on this input: asm(""); with gdb saying (edited for clarity): Program received signal SIGSEGV, Segmentation fault. in graph_ep (ep=0x7ffff7f62010) at graph.c:52 (gdb) p ep->entry $1 = (struct instruction *) 0x0 Sadly, the commit that introduced this crash: 15fa4d60e ("topasm: top-level asm is special") was (part of a bigger series) meant to fix crashes because of such toplevel asm statements. Toplevel ASM statements are quite abnormal: * they are toplevel but anonymous symbols * they should be limited to basic ASM syntax but are not * they are given the type SYM_FN but are not functions * there is nothing to evaluate or expand about it. These cause quite a few problems including crashes, even before the above commit. So, before handling them more correctly and instead of adding a bunch of special cases here and there, temporarily take the more radical approach of stopping to add them to the list of toplevel symbols. Fixes: 15fa4d60ebba3025495bb34f0718764336d3dfe0 Reported-by: Vegard Nossum <vegard.nossum@xxxxxxxxx> Analyzed-by: Vegard Nossum <vegard.nossum@xxxxxxxxx> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- parse.c | 2 +- validation/linear/asm-toplevel.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index ac795bd75..48a63f22f 100644 --- a/parse.c +++ b/parse.c @@ -2890,7 +2890,7 @@ static struct token *toplevel_asm_declaration(struct token *token, struct symbol token = parse_asm_statement(token, stmt); - add_symbol(list, anon); + // FIXME: add_symbol(list, anon); return token; } diff --git a/validation/linear/asm-toplevel.c b/validation/linear/asm-toplevel.c index 8bdd7fc12..bd3b58a6d 100644 --- a/validation/linear/asm-toplevel.c +++ b/validation/linear/asm-toplevel.c @@ -2,6 +2,7 @@ __asm__("/* nothing */"); /* * check-name: asm-toplevel.c * check-command: test-linearize $file + * check-known-to-fail * check-output-ignore * check-output-contains: asm *".. nothing .." */ -- 2.23.0