[M3devel] Strange behavior in recent CM3-compiled code...

Jay jay.krell at cornell.edu
Tue Jun 16 09:11:08 CEST 2009


Kneejerk generic response:

 

I don't know the operator precedence. Can you put in parens?

Have you looked at the code?

Can you mail us a small self contained repro?

Can you test it on birch?

  (That way -- all your files are there and easily gotten/investigated by others.)

Optimization enabled? Works without? I know, I shouldn't even ask this sort of thing without evidence.

 

 - Jay
 
> To: m3devel at elegosoft.com
> Date: Tue, 16 Jun 2009 00:01:18 -0700
> From: mika at async.caltech.edu
> CC: mika at camembert.async.caltech.edu
> Subject: [M3devel] Strange behavior in recent CM3-compiled code...
> 
> 
> Hello everyone,
> 
> I'm trying to update to the latest CM3 again, so that I can get my
> Mac working, and push my project of migrating a largish codebase
> from PM3 to CM3 a little further.
> 
> I updated CM3 today from CVS, on both my Mac and on a FreeBSD system,
> and ... my Scheme interpreter broke. Here's what the code looks like,
> with annotations:
> 
> 49 Debug.Out("t.rest = NIL? " & Fmt.Bool(t.rest=NIL));
> 50 Debug.Out("ISTYPE(t.rest,T)? " & Fmt.Bool(ISTYPE(t.rest,T)));
> 51 Debug.Out("Rest(t.rest) = NIL? " & Fmt.Bool(Rest(t.rest)=NIL));
> 52
> 53 IF t.rest # NIL AND ISTYPE(t.rest,T) AND Rest(t.rest) = NIL THEN
> 54 Debug.Out("in IF clause...");
> 55
> 56 IF SymEq(t.first, "quote") THEN special := "'"
> 57 ELSIF SymEq(t.first, "quasiquote") THEN special := "`"
> 58 ELSIF SymEq(t.first, "unquote") THEN special := ","
> 59 ELSIF SymEq(t.first, "unquote-splicing") THEN special := ",@"
> 60 END
> 61 ELSE
> 62 Debug.Out("in ELSE clause...")
> 63 END;
> 
> all you need to know is that Debug.Out prints out debugging information
> to the terminal. What I see is...
> 
> t.rest = NIL? FALSE
> ISTYPE(t.rest,T)? TRUE
> Rest(t.rest) = NIL? TRUE
> in ELSE clause...
> 
> What gives!?
> 
> Note this behavior occurs on both the Mac and on FreeBSD4 with a
> compiler and runtime bootstrapped today from some previous CM3.
> My old CM3 compiler was timestamped... April 30, I believe, and the
> code behaved properly under that one.
> 
> I believe I have also tried it both with and without compiler
> optimizations.
> 
> I find it baffling that so much stuff (mentor!) can work if "AND" isn't
> working right. This is the only if statement in many, many source files
> that seems to be working wrong.
> 
> Is it possible I'm missing something?? No I don't think so... here's a more
> explicit version:
> 
> Debug.Out("t.rest # NIL? " & Fmt.Bool(t.rest#NIL));
> Debug.Out("ISTYPE(t.rest,T)? " & Fmt.Bool(ISTYPE(t.rest,T)));
> Debug.Out("Rest(t.rest) = NIL? " & Fmt.Bool(Rest(t.rest)=NIL));
> Debug.Out("conjunction? " & Fmt.Bool(
> t.rest # NIL AND ISTYPE(t.rest,T) AND Rest(t.rest) = NIL ));
> IF t.rest # NIL AND ISTYPE(t.rest,T) AND Rest(t.rest) = NIL THEN
> ...
> 
> output is:
> 
> t.rest # NIL? TRUE
> ISTYPE(t.rest,T)? TRUE
> Rest(t.rest) = NIL? TRUE
> conjunction? FALSE
> in ELSE clause...
> 
> TRUE AND TRUE AND TRUE is FALSE??
> 
> Note that: 
> 
> VAR q, w, e := TRUE;
> 
> Debug.Out("conjunction? " & Fmt.Bool(
> q AND w AND e));
> 
> results in TRUE (as it should).
> 
> 
> Mika
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090616/154e69d4/attachment-0002.html>


More information about the M3devel mailing list