From 3474e202748fd84b7a168fcf633077dc6c6e17d0 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 1 Oct 2016 23:13:39 +0200 Subject: [PATCH] Deal with malformed mes instructions emitted by ego. --- mach/proto/mcg/parse_em.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mach/proto/mcg/parse_em.c b/mach/proto/mcg/parse_em.c index 7c0015184..4508d594c 100644 --- a/mach/proto/mcg/parse_em.c +++ b/mach/proto/mcg/parse_em.c @@ -328,11 +328,18 @@ static void parse_mes(void) case 3: /* register variable */ { - arith offset = mes_get_cst(); - int size = mes_get_cst(); - int type = mes_get_cst(); - int priority = mes_get_cst(); - tb_regvar(offset, size, type, priority); + /* ego will sometimes generate 'mes 3' pseudos with no actual + * parameters. Detect and ignore these. */ + + EM_getinstr(&em); + if (em.em_type == EM_MESARG) + { + arith offset = em.em_cst; + int size = mes_get_cst(); + int type = mes_get_cst(); + int priority = mes_get_cst(); + tb_regvar(offset, size, type, priority); + } break; } } -- 2.34.1