<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Well, the number 3 is REFANY_typecode.<BR>
I need to compare the if code to the printing code though..<BR>
 <BR>
 - Jay<BR> <BR>
<HR id=stopSpelling>
From: jay.krell@cornell.edu<BR>To: mika@async.caltech.edu<BR>CC: m3devel@elegosoft.com<BR>Subject: RE: [M3devel] Strange behavior in recent CM3-compiled code...<BR>Date: Tue, 16 Jun 2009 08:44:21 +0000<BR><BR>
<STYLE>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass body.EC_hmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Cool.<BR>Here is a smaller repro, on birch AMD64_LINUX.<BR> <BR>The problem is not the AND, the problem is the IF.<BR> <BR><BR>MODULE Main;<BR>IMPORT IO, Fmt;<BR>PROCEDURE PutLn(what : TEXT) =<BR>BEGIN IO.Put(what & "\n") END PutLn;<BR><BR>TYPE<BR>Pair = REF RECORD<BR>rest : REFANY;<BR>END;<BR>VAR<BR>t := NEW(Pair, rest := NEW(Pair, rest := NIL));<BR>BEGIN<BR>PutLn("ISTYPE(t.rest,Pair)? " & Fmt.Bool(ISTYPE(t.rest,Pair)));<BR>IF ISTYPE(t.rest,Pair) THEN<BR>PutLn("in IF clause...")<BR>ELSE<BR>PutLn("in ELSE clause...")<BR>END<BR>END Main.<BR><BR>Tony this is presumably your type tagging changes??<BR><BR>The problem in the code I think is the compare to the number 3.<BR><BR>.L13:<BR>        movq    312+MM_Main(%rip), %rax<BR>        cmpq    $3, %rax            <====<BR>        jne     .L14<BR>.L12:<BR>        .stabn  68,0,19,.LM9-.LFBB2<BR>.LM9:<BR>        leaq    128+L_1(%rip), %rdi<BR>        call    <A href="mailto:Main__PutLn@PLT">Main__PutLn@PLT</A><BR>        jmp     .L15<BR>        .p2align 4,,10<BR>        .p2align 3<BR>.L14:<BR>        .stabn  68,0,21,.LM10-.LFBB2<BR>.LM10:<BR>        leaq    168+L_1(%rip), %rdi<BR>        call    <A href="mailto:Main__PutLn@PLT">Main__PutLn@PLT</A><BR> <BR><BR>What is that for?<BR> <BR><BR>It comes right from the IL:<BR><BR>(118) set_source_line<BR>  source line   17<BR>(119) import_procedure<BR>  procedure RTHooks__CheckLoadTracedRef nparams 0x1 rettype 0xd<BR>(120) declare_param<BR>  param M3_Af40ku_ref type 0xb typeid 0x1c1c45e6 bytesize 0x40 alignment 0x40 in<BR>_memory 0x0 up_level 0x0<BR>  mode 0x11 (DImode)<BR>(121) set_runtime_proc<BR>(122) load<BR>  m3cg_load (MM_Main): offset 0x640, convert 0xb -> 0xb<BR>(123) store<BR>  store (noname) offset 0x0 src_t 0xb dst_t 0xb<BR>(124) load_nil<BR>(125) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(126) if_eq<BR>(127) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(128) loophole<BR>(129) load_integer<BR>  integer 0x1<BR>(130) and<BR>(131) if_true<BR>(132) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(133) load_indirect<BR>  load address offset 0xffffffffffffffc0 src_t 0x7 dst_t 0x7<BR>(134) extract_mn<BR>(135) if_false<BR>(136) start_call_direct<BR>  start call procedure RTHooks__CheckLoadTracedRef, level 0x0, type 0xd<BR>(137) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(138) pop_param<BR>  pop param type 0xb<BR>(139) call_direct<BR>  call procedure RTHooks__CheckLoadTracedRef, type 0xd<BR>(140) set_label<BR>(141) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(142) load_indirect<BR>  load address offset 0x0 src_t 0xb dst_t 0xb<BR>(143) store<BR>  store (noname) offset 0x0 src_t 0xb dst_t 0xb<BR>(144) load_nil<BR>(145) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(146) if_eq<BR>(147) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(148) loophole<BR>(149) load_integer<BR>  integer 0x1<BR>(150) and<BR>(151) if_true<BR>(152) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(153) load_indirect<BR>  load address offset 0xffffffffffffffc0 src_t 0x7 dst_t 0x7<BR>(154) extract_mn<BR>(155) if_false<BR>(156) start_call_direct<BR>  start call procedure RTHooks__CheckLoadTracedRef, level 0x0, type 0xd<BR>(157) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(158) pop_param<BR>  pop param type 0xb<BR>(159) call_direct<BR>  call procedure RTHooks__CheckLoadTracedRef, type 0xd<BR>(160) set_label<BR>(161) load_integer<BR>  integer 0x1<BR>(162) declare_temp<BR>  temp var type 0x7 size 0x40 alignment 0x40<BR>(163) store<BR>  store (noname) offset 0x0 src_t 0x7 dst_t 0x7<BR>(164) load_nil<BR>(165) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(166) if_eq<BR>(167) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(168) loophole<BR>(169) load_integer<BR>  integer 0x1<BR>(170) and<BR>(171) if_true<BR>(172) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(173) load_indirect<BR>  load address offset 0xffffffffffffffc0 src_t 0x7 dst_t 0x7<BR>(174) extract_mn<BR>(175) load<BR>  m3cg_load (MM_Main): offset 0x9c0, convert 0x7 -> 0x7<BR>(176) if_eq<BR>(177) jump<BR>(178) set_label<BR>(179) load_integer<BR>  integer 0x3<BR>(180) load<BR>  m3cg_load (MM_Main): offset 0x9c0, convert 0x7 -> 0x7<BR>(181) if_eq<BR>(182) set_label<BR>(183) load_integer<BR>  integer 0x0<BR>(184) store<BR>  store (noname) offset 0x0 src_t 0x7 dst_t 0x7<BR>(185) set_label<BR>(186) import_procedure<BR>  procedure Fmt__Bool nparams 0x1 rettype 0xb<BR>(187) declare_param<BR>  param M3_AicXUJ_b type 0x0 typeid 0x1e59237d bytesize 0x8 alignment 0x8 in_mem<BR>ory 0x0 up_level 0x0<BR>  mode 0xe ()<BR>(188) start_call_direct<BR>  start call procedure Fmt__Bool, level 0x0, type 0xb<BR>(189) load<BR>  m3cg_load (noname): offset 0x0, convert 0x7 -> 0x7<BR>(190) pop_param<BR>  pop param type 0x0<BR>(191) call_direct<BR>  call procedure Fmt__Bool, type 0xb<BR>(192) store<BR>  store (noname) offset 0x0 src_t 0xb dst_t 0xb<BR>(193) start_call_direct<BR>  start call procedure RTHooks__Concat, level 0x0, type 0xb<BR>(194) load_address<BR>  load address (L_1) offset 0x280<BR>(195) pop_param<BR>  pop param type 0xb<BR>(196) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(197) pop_param<BR>  pop param type 0xb<BR>(198) call_direct<BR>  call procedure RTHooks__Concat, type 0xb<BR>(199) store<BR>  store (noname) offset 0x0 src_t 0xb dst_t 0xb<BR>(200) start_call_direct<BR>  start call procedure Main__PutLn, level 0x0, type 0xd<BR>(201) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(202) pop_param<BR>  pop param type 0xb<BR>(203) call_direct<BR>  call procedure Main__PutLn, type 0xd<BR>(204) set_source_line<BR>  source line   18<BR>(205) load<BR>  m3cg_load (MM_Main): offset 0x640, convert 0xb -> 0xb<BR>(206) store<BR>  store (noname) offset 0x0 src_t 0xb dst_t 0xb<BR>(207) load_nil<BR>(208) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(209) if_eq<BR>(210) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(211) loophole<BR>(212) load_integer<BR>  integer 0x1<BR>(213) and<BR>(214) if_true<BR>(215) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(216) load_indirect<BR>  load address offset 0xffffffffffffffc0 src_t 0x7 dst_t 0x7<BR>(217) extract_mn<BR>(218) if_false<BR>(219) start_call_direct<BR>  start call procedure RTHooks__CheckLoadTracedRef, level 0x0, type 0xd<BR>(220) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(221) pop_param<BR>  pop param type 0xb<BR>(222) call_direct<BR>  call procedure RTHooks__CheckLoadTracedRef, type 0xd<BR>(223) set_label<BR>(224) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(225) load_indirect<BR>  load address offset 0x0 src_t 0xb dst_t 0xb<BR>(226) store<BR>  store (noname) offset 0x0 src_t 0xb dst_t 0xb<BR>(227) load_nil<BR>(228) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(229) if_eq<BR>(230) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(231) loophole<BR>(232) load_integer<BR>  integer 0x1<BR>(233) and<BR>(234) if_true<BR>(235) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(236) load_indirect<BR>  load address offset 0xffffffffffffffc0 src_t 0x7 dst_t 0x7<BR>(237) extract_mn<BR>(238) if_false<BR>(239) start_call_direct<BR>  start call procedure RTHooks__CheckLoadTracedRef, level 0x0, type 0xd<BR>(240) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(241) pop_param<BR>  pop param type 0xb<BR>(242) call_direct<BR>  call procedure RTHooks__CheckLoadTracedRef, type 0xd<BR>(243) set_label<BR>(244) load_nil<BR>(245) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(246) if_eq<BR>(247) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(248) loophole<BR>(249) load_integer<BR>  integer 0x1<BR>(250) and<BR>(251) if_true<BR>(252) load<BR>  m3cg_load (noname): offset 0x0, convert 0xb -> 0xb<BR>(253) load_indirect<BR>  load address offset 0xffffffffffffffc0 src_t 0x7 dst_t 0x7<BR>(254) extract_mn<BR>(255) load<BR>  m3cg_load (MM_Main): offset 0x9c0, convert 0x7 -> 0x7<BR>(256) if_ne<BR>(257) set_label<BR>(258) load_integer<BR>  integer 0x3               <===== <BR>(259) load<BR>  m3cg_load (MM_Main): offset 0x9c0, convert 0x7 -> 0x7<BR>(260) if_ne<BR>(261) set_label<BR>(262) set_source_line<BR>  source line   19<BR>(263) start_call_direct<BR>  start call procedure Main__PutLn, level 0x0, type 0xd<BR>(264) load_address<BR>  load address (L_1) offset 0x400<BR>(265) pop_param<BR>  pop param type 0xb<BR>(266) call_direct<BR>  call procedure Main__PutLn, type 0xd<BR>(267) jump<BR>(268) set_label<BR>(269) set_source_line<BR>  source line   21<BR>(270) start_call_direct<BR>  start call procedure Main__PutLn, level 0x0, type 0xd<BR>(271) load_address<BR>  load address (L_1) offset 0x540<BR>(272) pop_param<BR>  pop param type 0xb<BR>(273) call_direct<BR>  call procedure Main__PutLn, type 0xd<BR>(274) set_label<BR>(275) set_label<BR>(276) load_address<BR>  load address (MM_Main) offset 0x0<BR>(277) exit_proc<BR>(278) free_temp<BR>(279) free_temp<BR>(280) free_temp<BR>(281) free_temp<BR>(282) free_temp<BR>(283) end_procedure<BR>  procedure Main_M3<BR>(284) comment<BR>  comment: `global constant type descriptor'<BR>(285) declare_record<BR>  record id 0xffffffff, fields 0x0, size 0x940<BR>(286) comment<BR>  comment: `global data type descriptor'<BR> <BR> <BR>I'll dig a bit more.<BR> <BR><BR> - Jay<BR><BR><BR><BR><BR><BR><BR> <BR>> To: jay.krell@cornell.edu<BR>> Date: Tue, 16 Jun 2009 00:59:10 -0700<BR>> From: mika@async.caltech.edu<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] Strange behavior in recent CM3-compiled code...<BR>> <BR>> This small example exhibits it!<BR>> <BR>> MODULE Main;<BR>> IMPORT IO, Fmt;<BR>> <BR>> PROCEDURE PutLn(what : TEXT) =<BR>> BEGIN IO.Put(what & "\n") END PutLn;<BR>> <BR>> <BR>> TYPE <BR>> Pair = BRANDED "Pair" REF RECORD<BR>> first, rest : REFANY;<BR>> END;<BR>> <BR>> PROCEDURE Rest(p : Pair) : REFANY = <BR>> BEGIN<BR>> IF p = NIL THEN RETURN NIL ELSE RETURN p.rest END<BR>> END Rest;<BR>> <BR>> VAR <BR>> t := NEW(Pair, first := "first", <BR>> rest := NEW(Pair, first := "second", <BR>> rest := NIL));<BR>> <BR>> BEGIN<BR>> PutLn("t.rest # NIL? " & Fmt.Bool(t.rest#NIL));<BR>> PutLn("ISTYPE(t.rest,Pair)? " & Fmt.Bool(ISTYPE(t.rest,Pair)));<BR>> PutLn("Rest(t.rest) = NIL? " & Fmt.Bool(Rest(t.rest)=NIL));<BR>> PutLn("conjunction? " & Fmt.Bool(<BR>> (t.rest # NIL) AND (ISTYPE(t.rest,Pair)) AND (Rest(t.rest) = NIL) ));<BR>> IF (t.rest # NIL) AND (ISTYPE(t.rest,Pair)) AND (Rest(t.rest) = NIL) THEN<BR>> PutLn("in IF clause...")<BR>> ELSE<BR>> PutLn("in ELSE clause...")<BR>> END<BR>> END Main.<BR>> <BR>> Output:<BR>> <BR>> (133)rover:~/testcm3/src>m3build -O<BR>> --- building in ../FreeBSD4 ---<BR>> m3build: missing ../src/m3overrides<BR>> new source -> compiling ../src/Main.m3<BR>> -> linking prog<BR>> (134)rover:~/testcm3/src>../FreeBSD4/prog<BR>> t.rest # NIL? TRUE<BR>> ISTYPE(t.rest,Pair)? TRUE<BR>> Rest(t.rest) = NIL? TRUE<BR>> conjunction? TRUE<BR>> in IF clause...<BR>> (135)rover:~/testcm3/src>cm3 -clean<BR>> --- cleaning ../FreeBSD4 ---<BR>> <BR>> (136)rover:~/testcm3/src>cm3<BR>> --- building in ../FreeBSD4 ---<BR>> <BR>> new source -> compiling Main.m3<BR>> -> linking prog<BR>> (137)rover:~/testcm3/src>../FreeBSD4/prog <BR>> t.rest # NIL? TRUE<BR>> ISTYPE(t.rest,Pair)? TRUE<BR>> Rest(t.rest) = NIL? TRUE<BR>> conjunction? FALSE<BR>> in ELSE clause...<BR>> (138)rover:~/testcm3/src><BR>> <BR>> Jay writes:<BR>> >--_55f6c801-7d57-4602-a131-dda139b64dfd_<BR>> >Content-Type: text/plain; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><BR>> >Kneejerk generic response:<BR>> ><BR>> >=20<BR>> ><BR>> >I don't know the operator precedence. Can you put in parens?<BR>> ><BR>> >Have you looked at the code?<BR>> ><BR>> >Can you mail us a small self contained repro?<BR>> ><BR>> >Can you test it on birch?<BR>> ><BR>> > (That way -- all your files are there and easily gotten/investigated by o=<BR>> >thers.)<BR>> ><BR>> >Optimization enabled? Works without? I know=2C I shouldn't even ask this so=<BR>> >rt of thing without evidence.<BR>> ><BR>> >=20<BR>> ><BR>> > - Jay<BR>> >=20<BR>> >> To: m3devel@elegosoft.com<BR>> >> Date: Tue=2C 16 Jun 2009 00:01:18 -0700<BR>> >> From: mika@async.caltech.edu<BR>> >> CC: mika@camembert.async.caltech.edu<BR>> >> Subject: [M3devel] Strange behavior in recent CM3-compiled code...<BR>> >>=20<BR>> >>=20<BR>> >> Hello everyone=2C<BR>> >>=20<BR>> >> I'm trying to update to the latest CM3 again=2C so that I can get my<BR>> >> Mac working=2C and push my project of migrating a largish codebase<BR>> >> from PM3 to CM3 a little further.<BR>> >>=20<BR>> >> I updated CM3 today from CVS=2C on both my Mac and on a FreeBSD system=2C<BR>> >> and ... my Scheme interpreter broke. Here's what the code looks like=2C<BR>> >> with annotations:<BR>> >>=20<BR>> >> 49 Debug.Out("t.rest =3D NIL? " & Fmt.Bool(t.rest=3DNIL))=3B<BR>> >> 50 Debug.Out("ISTYPE(t.rest=2CT)? " & Fmt.Bool(ISTYPE(t.rest=2CT)))=3B<BR>> >> 51 Debug.Out("Rest(t.rest) =3D NIL? " & Fmt.Bool(Rest(t.rest)=3DNIL))=3B<BR>> >> 52<BR>> >> 53 IF t.rest # NIL AND ISTYPE(t.rest=2CT) AND Rest(t.rest) =3D NIL THEN<BR>> >> 54 Debug.Out("in IF clause...")=3B<BR>> >> 55<BR>> >> 56 IF SymEq(t.first=2C "quote") THEN special :=3D "'"<BR>> >> 57 ELSIF SymEq(t.first=2C "quasiquote") THEN special :=3D "`"<BR>> >> 58 ELSIF SymEq(t.first=2C "unquote") THEN special :=3D "=2C"<BR>> >> 59 ELSIF SymEq(t.first=2C "unquote-splicing") THEN special :=3D "=2C@"<BR>> >> 60 END<BR>> >> 61 ELSE<BR>> >> 62 Debug.Out("in ELSE clause...")<BR>> >> 63 END=3B<BR>> >>=20<BR>> >> all you need to know is that Debug.Out prints out debugging information<BR>> >> to the terminal. What I see is...<BR>> >>=20<BR>> >> t.rest =3D NIL? FALSE<BR>> >> ISTYPE(t.rest=2CT)? TRUE<BR>> >> Rest(t.rest) =3D NIL? TRUE<BR>> >> in ELSE clause...<BR>> >>=20<BR>> >> What gives!?<BR>> >>=20<BR>> >> Note this behavior occurs on both the Mac and on FreeBSD4 with a<BR>> > compiler and runtime bootstrapped today from some previous CM3.<BR>> >> My old CM3 compiler was timestamped... April 30=2C I believe=2C and the<BR>> >> code behaved properly under that one.<BR>> >>=20<BR>> >> I believe I have also tried it both with and without compiler<BR>> >> optimizations.<BR>> >>=20<BR>> >> I find it baffling that so much stuff (mentor!) can work if "AND" isn't<BR>> >> working right. This is the only if statement in many=2C many source files<BR>> >> that seems to be working wrong.<BR>> >>=20<BR>> >> Is it possible I'm missing something?? No I don't think so... here's a mo=<BR>> >re<BR>> >> explicit version:<BR>> >>=20<BR>> >> Debug.Out("t.rest # NIL? " & Fmt.Bool(t.rest#NIL))=3B<BR>> >> Debug.Out("ISTYPE(t.rest=2CT)? " & Fmt.Bool(ISTYPE(t.rest=2CT)))=3B<BR>> >> Debug.Out("Rest(t.rest) =3D NIL? " & Fmt.Bool(Rest(t.rest)=3DNIL))=3B<BR>> >> Debug.Out("conjunction? " & Fmt.Bool(<BR>> >> t.rest # NIL AND ISTYPE(t.rest=2CT) AND Rest(t.rest) =3D NIL ))=3B<BR>> >> IF t.rest # NIL AND ISTYPE(t.rest=2CT) AND Rest(t.rest) =3D NIL THEN<BR>> >> ...<BR>> >>=20<BR>> >> output is:<BR>> >>=20<BR>> >> t.rest # NIL? TRUE<BR>> >> ISTYPE(t.rest=2CT)? TRUE<BR>> >> Rest(t.rest) =3D NIL? TRUE<BR>> >> conjunction? FALSE<BR>> >> in ELSE clause...<BR>> >>=20<BR>> >> TRUE AND TRUE AND TRUE is FALSE??<BR>> >>=20<BR>> >> Note that:=20<BR>> >>=20<BR>> >> VAR q=2C w=2C e :=3D TRUE=3B<BR>> >>=20<BR>> >> Debug.Out("conjunction? " & Fmt.Bool(<BR>> >> q AND w AND e))=3B<BR>> >>=20<BR>> >> results in TRUE (as it should).<BR>> >>=20<BR>> >>=20<BR>> >> Mika<BR>> >>=20<BR>> ><BR>> >--_55f6c801-7d57-4602-a131-dda139b64dfd_<BR>> >Content-Type: text/html; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><html><BR>> ><head><BR>> ><style><BR>> >.hmmessage P<BR>> >{<BR>> >margin:0px=3B<BR>> >padding:0px<BR>> >}<BR>> >body.hmmessage<BR>> >{<BR>> >font-size: 10pt=3B<BR>> >font-family:Verdana<BR>> >}<BR>> ></style><BR>> ></head><BR>> ><body class=3D'hmmessage'><BR>> >Kneejerk generic response:<BR><BR>> >&nbsp=3B<BR><BR>> >I don't know the operator precedence. Can you put in parens?<BR><BR>> >Have you looked at the code?<BR><BR>> >Can you mail us a small self contained repro?<BR><BR>> >Can you test it on birch?<BR><BR>> >&nbsp=3B (That way -- all your files are there and easily gotten/investigat=<BR>> >ed by others.)<BR><BR>> >Optimization enabled? Works without? I know=2C I shouldn't even ask this so=<BR>> >rt of thing without evidence.<BR><BR>> >&nbsp=3B<BR><BR>> >&nbsp=3B- Jay<BR>&nbsp=3B<BR>&gt=3B To: m3devel@elegosoft.com<BR>&gt=3B Dat=<BR>> >e: Tue=2C 16 Jun 2009 00:01:18 -0700<BR>&gt=3B From: mika@async.caltech.edu=<BR>> ><BR>&gt=3B CC: mika@camembert.async.caltech.edu<BR>&gt=3B Subject: [M3devel=<BR>> >] Strange behavior in recent CM3-compiled code...<BR>&gt=3B <BR>&gt=3B <BR>=<BR>> >&gt=3B Hello everyone=2C<BR>&gt=3B <BR>&gt=3B I'm trying to update to the l=<BR>> >atest CM3 again=2C so that I can get my<BR>&gt=3B Mac working=2C and push m=<BR>> >y project of migrating a largish codebase<BR>&gt=3B from PM3 to CM3 a littl=<BR>> >e further.<BR>&gt=3B <BR>&gt=3B I updated CM3 today from CVS=2C on both my =<BR>> >Mac and on a FreeBSD system=2C<BR>&gt=3B and ... my Scheme interpreter brok=<BR>> >e. Here's what the code looks like=2C<BR>&gt=3B with annotations:<BR>&gt=3B=<BR>> > <BR>&gt=3B 49 Debug.Out("t.rest =3D NIL? " &amp=3B Fmt.Bool(t.rest=3DNIL))=<BR>> >=3B<BR>&gt=3B 50 Debug.Out("ISTYPE(t.rest=2CT)? " &amp=3B Fmt.Bool(ISTYPE(t=<BR>> >.rest=2CT)))=3B<BR>&gt=3B 51 Debug.Out("Rest(t.rest) =3D NIL? " &amp=3B Fmt=<BR>> >.Bool(Rest(t.rest)=3DNIL))=3B<BR>&gt=3B 52<BR>&gt=3B 53 IF t.rest # NIL AND=<BR>> > ISTYPE(t.rest=2CT) AND Rest(t.rest) =3D NIL THEN<BR>&gt=3B 54 Debug.Out("i=<BR>> >n IF clause...")=3B<BR>&gt=3B 55<BR>&gt=3B 56 IF SymEq(t.first=2C "quote") =<BR>> >THEN special :=3D "'"<BR>&gt=3B 57 ELSIF SymEq(t.first=2C "quasiquote") THE=<BR>> >N special :=3D "`"<BR>&gt=3B 58 ELSIF SymEq(t.first=2C "unquote") THEN spec=<BR>> >ial :=3D "=2C"<BR>&gt=3B 59 ELSIF SymEq(t.first=2C "unquote-splicing") THEN=<BR>> > special :=3D "=2C@"<BR>&gt=3B 60 END<BR>&gt=3B 61 ELSE<BR>&gt=3B 62 Debug.=<BR>> >Out("in ELSE clause...")<BR>&gt=3B 63 END=3B<BR>&gt=3B <BR>&gt=3B all you n=<BR>> >eed to know is that Debug.Out prints out debugging information<BR>&gt=3B to=<BR>> > the terminal. What I see is...<BR>&gt=3B <BR>&gt=3B t.rest =3D NIL? FALSE<=<BR>> >BR>&gt=3B ISTYPE(t.rest=2CT)? TRUE<BR>&gt=3B Rest(t.rest) =3D NIL? TRUE<BR>=<BR>> >&gt=3B in ELSE clause...<BR>&gt=3B <BR>&gt=3B What gives!?<BR>&gt=3B <BR>&g=<BR>> >t=3B Note this behavior occurs on both the Mac and on FreeBSD4 with a<BR>&g=<BR>> >t=3B compiler and runtime bootstrapped today from some previous CM3.<BR>&gt=<BR>> >=3B My old CM3 compiler was timestamped... April 30=2C I believe=2C and the=<BR>> ><BR>&gt=3B code behaved properly under that one.<BR>&gt=3B <BR>&gt=3B I bel=<BR>> >ieve I have also tried it both with and without compiler<BR>&gt=3B optimiza=<BR>> >tions.<BR>&gt=3B <BR>&gt=3B I find it baffling that so much stuff (mentor!)=<BR>> > can work if "AND" isn't<BR>&gt=3B working right. This is the only if state=<BR>> >ment in many=2C many source files<BR>&gt=3B that seems to be working wrong.=<BR>> ><BR>&gt=3B <BR>&gt=3B Is it possible I'm missing something?? No I don't thi=<BR>> >nk so... here's a more<BR>&gt=3B explicit version:<BR>&gt=3B <BR>&gt=3B Deb=<BR>> >ug.Out("t.rest # NIL? " &amp=3B Fmt.Bool(t.rest#NIL))=3B<BR>&gt=3B Debug.Ou=<BR>> >t("ISTYPE(t.rest=2CT)? " &amp=3B Fmt.Bool(ISTYPE(t.rest=2CT)))=3B<BR>&gt=3B=<BR>> > Debug.Out("Rest(t.rest) =3D NIL? " &amp=3B Fmt.Bool(Rest(t.rest)=3DNIL))=<BR>> >=3B<BR>&gt=3B Debug.Out("conjunction? " &amp=3B Fmt.Bool(<BR>&gt=3B t.rest =<BR>> ># NIL AND ISTYPE(t.rest=2CT) AND Rest(t.rest) =3D NIL ))=3B<BR>&gt=3B IF t.=<BR>> >rest # NIL AND ISTYPE(t.rest=2CT) AND Rest(t.rest) =3D NIL THEN<BR>&gt=3B .=<BR>> >..<BR>&gt=3B <BR>&gt=3B output is:<BR>&gt=3B <BR>&gt=3B t.rest # NIL? TRUE<=<BR>> >BR>&gt=3B ISTYPE(t.rest=2CT)? TRUE<BR>&gt=3B Rest(t.rest) =3D NIL? TRUE<BR>=<BR>> >&gt=3B conjunction? FALSE<BR>&gt=3B in ELSE clause...<BR>&gt=3B <BR>&gt=3B =<BR>> >TRUE AND TRUE AND TRUE is FALSE??<BR>&gt=3B <BR>&gt=3B Note that: <BR>&gt=<BR>> >=3B <BR>&gt=3B VAR q=2C w=2C e :=3D TRUE=3B<BR>&gt=3B <BR>&gt=3B Debug.Out(=<BR>> >"conjunction? " &amp=3B Fmt.Bool(<BR>&gt=3B q AND w AND e))=3B<BR>&gt=3B <B=<BR>> >R>&gt=3B results in TRUE (as it should).<BR>&gt=3B <BR>&gt=3B <BR>&gt=3B Mi=<BR>> >ka<BR>&gt=3B <BR></body><BR>> ></html>=<BR>> ><BR>> >--_55f6c801-7d57-4602-a131-dda139b64dfd_--<BR></body>
</html>