NetBSD Problem Report #57056

From  Thu Oct 13 23:53:45 2022
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 026DA1A9239
	for <>; Thu, 13 Oct 2022 23:53:45 +0000 (UTC)
Message-Id: <>
Date: Thu, 13 Oct 2022 23:53:43 +0000 (UTC)
Subject: spim and xspim run in an endless loop due to a bug in CPU/scanner.l
X-Send-Pr-Version: www-1.0

>Number:         57056
>Category:       pkg
>Synopsis:       spim and xspim run in an endless loop due to a bug in CPU/scanner.l
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 13 23:55:00 +0000 2022
>Originator:     .:VMS:.
>Release:        9.3 current Thu Oct 13 23:40:26 UTC 2022
NetBSD localhost 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022 amd64

spim and xspim run an endless loop because a bug related with flex.

It seems to use flex to parse assembly instructions, as it's a mips assembly interpreter, you give it asm code and it executes it.

The bug is at file CPU/scanner.l at line 319

  /* flex 2.5.33 flipped the polarity of this flag (sigh) */
  yy_init = 0;                                                                                                     
  yy_init = 1;    

This is the bug

it seems flex versions prior to that one needed that variable to be 1 instead of 0, the thing is the NetBSD flex's version does not match with this #if directive so yy_init is set to 1 when it should be a 0.

in my case I've just typed 'make' to download the source code and removed this stuff and just put 'yy_init = 0;'

this solves the problem and now xspim seems to work and I assume spim will do too.

I have no idea on how to make a patch file so I can't help more than that.

Anyways that's the source of the bug and it's avoided by just setting yy_init to 0.

Note that it's mlelstv who spotted the bug as I would have no idea if not :D so thank him instead, I'm just sending the pr so the mantainer can fix that.

install spim and run spim or xspim, it won't work.

set yy_init to 0 or fix that #if directive to match that flex version and possible future ones 

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2022 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.