<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
I was a bit off. It is actually set of enum. Like this:<div><br></div><div><div>MODULE TypeCaseStmt;</div><div><br></div><div>TYPE T1 = {A,B};</div><div>TYPE T2 = SET OF T1;</div><div> </div><div>PROCEDURE GetOutcomex (): T2 =</div><div>  VAR oc := T2 {};</div><div>  BEGIN</div><div>    RETURN oc;</div><div>  END GetOutcomex;</div><div><br></div><div>BEGIN</div><div>END TypeCaseStmt.</div><div><br></div><div> - Jay</div><br><hr id="stopSpelling">From: jay.krell@cornell.edu<br>To: m3devel@elegosoft.com; hosking@cs.purdue.edu<br>Date: Sun, 27 Jun 2010 08:12:54 +0000<br>Subject: [M3devel] m3cg 4.5 problem<br><br>



<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>


<div>This tiny bit of code, which is cut down from m3front, causes an assertion failure in a 4.5 m3cg:</div><div><br></div><div>MODULE TypeCaseStmt;</div><div><br></div><div>IMPORT M3ID, CG, Expr, Stmt, StmtRep, Type, Variable, Scope;</div><div><br></div><div>PROCEDURE GetOutcomex (): Stmt.Outcomes =</div><div>  VAR oc := Stmt.Outcomes {};  line 6</div><div>  BEGIN</div><div>    RETURN oc;</div><div>  END GetOutcomex;</div><div><br></div><div>BEGIN</div><div>END TypeCaseStmt.</div><div><br></div><div>../src/stmts/TypeCaseStmt.m3:6:0: internal compiler error: in gimplify_expr, at gimplify.c:7315</div><div>Please submit a full bug report,</div><div><br></div><div><br></div><div><div><div>(1) begin_unit</div><div>(2) set_source_file</div><div>(3) set_source_line</div><div>  source line    1</div><div>(4) comment</div><div>  comment: `module global constants'</div><div>(5) declare_segment</div><div>  segment L_1 typeid 0xffffffff</div><div>(6) comment</div><div>  comment: `module global data'</div><div>(7) declare_segment</div><div>  segment MM_TypeCaseStmt typeid 0xffffffff</div><div>(8) set_source_line</div><div>  source line   11</div><div>(9) declare_procedure</div><div>  type:addr</div><div>  procedure:TypeCaseStmt_M3 nparams:0x1 rettype:addr lev:0 exported:1</div><div>(10) declare_param</div><div>  type:int64</div><div>  param M3_AcxOUs_mode type:int64 typeid:0x195c2a74 bytesize:0x40 alignment:0x40 in_memory:0x0 up_level:0x0</div><div>  mode 0x11 (DImode)</div><div>(11) import_procedure</div><div>  type:addr</div><div>  procedure:TypeCaseStmt_I3 nparams:0x0 rettype:addr</div><div>(12) export_unit</div><div>(13) import_procedure</div><div>  type:addr</div><div>  procedure:Scope_I3 nparams:0x0 rettype:addr</div><div>(14) import_unit</div><div>(15) import_procedure</div><div>  type:addr</div><div>  procedure:Variable_I3 nparams:0x0 rettype:addr</div><div>(16) import_unit</div><div>(17) import_procedure</div><div>  type:addr</div><div>  procedure:Type_I3 nparams:0x0 rettype:addr</div><div>(18) import_unit</div><div>(19) import_procedure</div><div>  type:addr</div><div>  procedure:StmtRep_I3 nparams:0x0 rettype:addr</div><div>(20) import_unit</div><div>(21) import_procedure</div><div>  type:addr</div><div>  procedure:Stmt_I3 nparams:0x0 rettype:addr</div><div>(22) import_unit</div><div>(23) import_procedure</div><div>  type:addr</div><div>  procedure:Expr_I3 nparams:0x0 rettype:addr</div><div>(24) import_unit</div><div>(25) import_procedure</div><div>  type:addr</div><div>  procedure:CG_I3 nparams:0x0 rettype:addr</div><div>(26) import_unit</div><div>(27) import_procedure</div><div>  type:addr</div><div>  procedure:M3ID_I3 nparams:0x0 rettype:addr</div><div>(28) import_unit</div><div>(29) import_procedure</div><div>  type:addr</div><div>  procedure:RTHooks_I3 nparams:0x0 rettype:addr</div><div>(30) import_unit</div><div>(31) declare_procedure</div><div>  type:word64</div><div>  procedure:TypeCaseStmt__GetOutcomex nparams:0x0 rettype:word64 lev:0 exported:0</div><div>(32) declare_local</div><div>  type:word64</div><div>  local var M3_EXQtd6_oc type:word64 size:0x40 alignment:0x40</div><div>(33) declare_local</div><div>  type:word64</div><div>  local var M3_EXQtd6__result type:word64 size:0x40 alignment:0x40</div><div>(34) comment</div><div>  comment: `GetOutcomex'</div><div>(35) set_source_line</div><div>  source line    5</div><div>(36) begin_procedure</div><div>  procedure TypeCaseStmt__GetOutcomex</div><div> TypeCaseStmt__GetOutcomex(37) set_source_line</div><div>  source line    6</div><div>(38) load_integer</div><div>  type:int64</div><div>  integer:0x0</div><div>(39) store</div><div>  type:int64</div><div>  type:int64</div><div>  store (M3_EXQtd6_oc) offset:0x0 src_t:int64 dst_t:int64</div><div>(40) set_source_line</div><div>  source line    8</div><div>(41) load</div><div>  type:word64</div><div>  type:int64</div><div>  m3cg_load (M3_EXQtd6_oc): offset 0x0, convert word64 -> int64</div><div>(42) exit_proc</div><div>  type:word64</div><div>(43) end_procedure</div><div>  procedure TypeCaseStmt__GetOutcomex</div><div><br></div><div><br></div><div><div>Breakpoint 1, fancy_abort (file=0x1009f0c6f "../../gcc-4.5/gcc/gimplify.c", line=7315, function=0x1009f1242 "gimplify_expr") at ../../gcc-4.5/gcc/diagnostic.c:763</div><div>763<span class="ecxApple-tab-span" style="white-space:pre"> </span>  internal_error ("in %s, at %s:%d", function, trim_filename (file), line);</div><div>(gdb) bt</div><div>#0  fancy_abort (file=0x1009f0c6f "../../gcc-4.5/gcc/gimplify.c", line=7315, function=0x1009f1242 "gimplify_expr") at ../../gcc-4.5/gcc/diagnostic.c:763</div><div>#1  0x00000001004cc4d6 in gimplify_expr (expr_p=0x1410e2060, pre_p=0x7fff5fbff420, post_p=0x7fff5fbfeff8, gimple_test_f=0x1004aac7f <is_gimple_lvalue>, fallback=2) at ../../gcc-4.5/gcc/gimplify.c:7315</div><div>#2  0x00000001004c5ad3 in gimplify_modify_expr (expr_p=0x1416a5f28, pre_p=0x7fff5fbff420, post_p=0x7fff5fbfeff8, want_value=0 '\0') at ../../gcc-4.5/gcc/gimplify.c:4444</div><div>#3  0x00000001004caafc in gimplify_expr (expr_p=0x1416a5f28, pre_p=0x7fff5fbff420, post_p=0x7fff5fbfeff8, gimple_test_f=0x1004ab1a6 <is_gimple_stmt>, fallback=0) at ../../gcc-4.5/gcc/gimplify.c:6619</div><div>#4  0x00000001004c7800 in gimplify_stmt (stmt_p=0x1416a5f28, seq_p=0x7fff5fbff420) at ../../gcc-4.5/gcc/gimplify.c:5264</div><div>#5  0x00000001004be376 in gimplify_statement_list (expr_p=0x1416c4030, pre_p=0x7fff5fbff420) at ../../gcc-4.5/gcc/gimplify.c:1382</div><div>#6  0x00000001004cb6f5 in gimplify_expr (expr_p=0x1416c4030, pre_p=0x7fff5fbff420, post_p=0x7fff5fbff2e8, gimple_test_f=0x1004ab1a6 <is_gimple_stmt>, fallback=0) at ../../gcc-4.5/gcc/gimplify.c:6935</div><div>#7  0x00000001004c7800 in gimplify_stmt (stmt_p=0x1416c4030, seq_p=0x7fff5fbff420) at ../../gcc-4.5/gcc/gimplify.c:5264</div><div>#8  0x00000001004bdb6c in gimplify_bind_expr (expr_p=0x1416c2298, pre_p=0x7fff5fbff778) at ../../gcc-4.5/gcc/gimplify.c:1127</div><div>#9  0x00000001004cae2b in gimplify_expr (expr_p=0x1416c2298, pre_p=0x7fff5fbff778, post_p=0x7fff5fbff618, gimple_test_f=0x1004ab1a6 <is_gimple_stmt>, fallback=0) at ../../gcc-4.5/gcc/gimplify.c:6719</div><div>#10 0x00000001004c7800 in gimplify_stmt (stmt_p=0x1416c2298, seq_p=0x7fff5fbff778) at ../../gcc-4.5/gcc/gimplify.c:5264</div><div>#11 0x00000001004ccbe6 in gimplify_body (body_p=0x1416c2298, fndecl=0x1416c2200, do_parms=1 '\001') at ../../gcc-4.5/gcc/gimplify.c:7528</div><div>#12 0x00000001004cceae in gimplify_function_tree (fndecl=0x1416c2200) at ../../gcc-4.5/gcc/gimplify.c:7624</div><div>#13 0x00000001000069c7 in m3_gimplify_function (fndecl=0x1416c2200) at ../../gcc-4.5/gcc/m3cg/parse.c:2370</div><div>#14 0x0000000100009cb4 in m3cg_end_procedure () at ../../gcc-4.5/gcc/m3cg/parse.c:3642</div><div>#15 0x000000010000feb5 in m3_parse_file (xx=0) at ../../gcc-4.5/gcc/m3cg/parse.c:5550</div><div>#16 0x00000001006be6a2 in compile_file () at ../../gcc-4.5/gcc/toplev.c:1053</div><div>#17 0x00000001006c0e19 in do_compile () at ../../gcc-4.5/gcc/toplev.c:2415</div><div>#18 0x00000001006c0ee0 in toplev_main (argc=3, argv=0x7fff5fbff930) at ../../gcc-4.5/gcc/toplev.c:2457</div><div>#19 0x000000010001743b in main (argc=3, argv=0x7fff5fbff930) at ../../gcc-4.5/gcc/main.c:35</div><div>(</div><div><br></div></div></div><div><br></div><div>Wierd, huh?</div><div><br></div><div>The only thing I can think of an int/word mismatch.</div><div>I did change one instance of Integer to Word, after finding this.</div><div>Stmt.Outcomes is an enumeration.</div><div>So presumably Stmt.Outcomes { } is 0.</div><div>Enumerations should work equally well as Integer or Word, right?</div><div>Clearly above there is still a mix. I can try changing them all to Word.</div><div><br></div><div><br></div><div>I'll keep digging.</div><div><br></div><div><br></div><div>Maybe dump the entire function generic tree for this and similar C.</div><div><br></div><div><br></div><div> - Jay</div></div></div>                                    </body>
</html>