[M3devel] Mailing list archive
Olaf Wagner
wagner at elegosoft.com
Tue Sep 29 23:26:59 CEST 2009
Quoting Roland Illig <roland.illig at gmx.de>:
> Hi,
>
> I would like to fix a bug I found in 2005, but the bug's details are
> not in trac, but only in a mailing list archive, which isn't available
> anymore.
>
> https://projects.elego.de/cm3/ticket/640
>
> Can anyone provide me with the details?
Here is a copy of your old mail:
X-Authenticated: #530625
Date: Tue, 11 Oct 2005 10:57:29 +0200
From: Roland Illig <roland.illig at gmx.de>
To: m3devel at elegosoft.com
Subject: quake bug: local variable disappears
X-Y-GMX-Trusted: 0
X-Virus-Scanned: by amavis (elego Software Solutions GmbH)
X-List-Check-m3devel-pint-elegosoft-com: approved
X-Virus-Scanned: by amavis (elego Software Solutions GmbH)
X-Copy: forwarded from wagner at elego.de
X-Virus-Scanned: by amavis (elego Software Solutions GmbH)
X-Keywords:
X-UID: 12885
proc first_of(arr) is
foreach e in arr
if not empty(e)
return e
end
end
return "cc"
end
proc compile_c(source, object, includes, o_flag, d_flag) is
local cmd = []
local cc = first_of([$CC, "cc"])
cmd += [cc]
return try_exec(cmd)
end
c_source("main")
c_program("test")
Critical Mass Modula-3 version d5.2.7
last updated: 2004-10-31
--- building in NetBSD2_i386 ---
new source -> compiling main.c
"/home/roland/proj/m3/c-test/src/m3makefile", line 14: quake runtime
error: undefined variable: cmd
The bug only shows because of:
- the order of the two "local" statements in compile_c
- a procedure is called
- a "foreach" loop appears in the procedure
- the "return" from inside the "foreach" loop is executed
Roland
--
Olaf Wagner -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
More information about the M3devel
mailing list