<div dir="ltr">I may have been a tad hasty in blaming the back end for the crashes, the front end has some explaining to do as well.<div><br></div><div>I was getting an infinite loop in a program which I have cut down here to demonstrate. The original cm3 5.2 I think it</div><div>was from elegosoft worked fine. The latest produces different intermediate code.</div><div><br></div><div>First the source, (excuse the size, its extracted from my implementation of grisu which I was on the point of pushing to github)</div><div><br></div><div><div>MODULE Main;</div><div><br></div><div>IMPORT Long,IO,Fmt;</div><div><br></div><div>CONST</div><div> kUint64MSB = 16_8000000000000000L;</div><div><br></div><div>TYPE</div><div> Uint64 = Long.T;</div><div> </div><div>PROCEDURE Normalize(sig : Long.T; exp : INTEGER) =</div><div> CONST</div><div> k10MSBits = 16_FFC0000000000000L;</div><div> VAR</div><div> significand : Uint64;</div><div> exponent : INTEGER;</div><div><br></div><div> BEGIN</div><div> <*ASSERT sig # 0L *></div><div> significand := sig;</div><div> exponent := exp;</div><div>(*IO.Put("sig init " & Fmt.LongInt(significand) & "\n");*)</div><div><br></div><div> (* This method is mainly called for normalizing boundaries. In general</div><div> boundaries need to be shifted by 10 bits. We thus optimize for this case. *)</div><div> WHILE Long.And(significand, k10MSBits) = 0L DO</div><div> significand := Long.LeftShift(significand, 10);</div><div>(*IO.Put("sig loop 1 " & Fmt.LongInt(significand) & "\n");*)</div><div> DEC(exponent, 10);</div><div> END;</div><div>(*IO.Put("sig after loop 1 " & Fmt.LongInt(significand) & "\n");*)</div><div>(*</div><div>IO.PutLongInt(Long.And(significand, kUint64MSB));</div><div>IO.Put("\n");</div><div>*)</div><div> WHILE Long.And(significand, kUint64MSB) = 0L DO</div><div>(*IO.Put("sig loop2 1 " & Fmt.LongInt(significand) & "\n");*)</div><div> significand := Long.LeftShift(significand, 1);</div><div>(*IO.Put("sig loop2 2 " & Fmt.LongInt(significand) & "\n");*)</div><div> DEC(exponent);</div><div> END;</div><div> </div><div> END Normalize;</div><div> </div><div>BEGIN</div><div><br></div><div> Normalize(3L,2);</div><div>END Main.</div></div><div><br></div><div>Now the correct intermediate from the original cm3 </div><div>Its a shame we cant embed the cm3 version into the intermediate. But theres no mention of widechar so you can tell its an old</div><div>version.</div><div><br></div><div><div><span class="" style="white-space:pre"> </span>begin_unit<span class="" style="white-space:pre"> </span> 0</div><div><span class="" style="white-space:pre"> </span>-----FILE ../src/Main.m3 -----</div><div><span class="" style="white-space:pre"> </span>-----LINE 1 -----</div><div><span class="" style="white-space:pre"> </span># module global constants</div><div><span class="" style="white-space:pre"> </span>declare_segment<span class="" style="white-space:pre"> </span> * -1 T v.1</div><div><span class="" style="white-space:pre"> </span># module global data</div><div><span class="" style="white-space:pre"> </span>declare_segment<span class="" style="white-space:pre"> </span> M_Main -1 F v.2</div><div><span class="" style="white-space:pre"> </span>-----LINE 45 -----</div><div><span class="" style="white-space:pre"> </span>declare_procedure<span class="" style="white-space:pre"> </span> Main_M3 1 Addr 0 0 T * p.1</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> mode 4 4 Int.32 425470580 F F 100 v.3</div><div><span class="" style="white-space:pre"> </span>declare_proctype<span class="" style="white-space:pre"> </span> 1318003907 2 0 0 0</div><div><span class="" style="white-space:pre"> </span>declare_formal<span class="" style="white-space:pre"> </span> sig 89530742</div><div><span class="" style="white-space:pre"> </span>declare_formal<span class="" style="white-space:pre"> </span> exp 425470580</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> Main_I3 0 Addr 0 p.2</div><div><span class="" style="white-space:pre"> </span>export_unit<span class="" style="white-space:pre"> </span> Main</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> Fmt_I3 0 Addr 0 p.3</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> Fmt</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> IO_I3 0 Addr 0 p.4</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> IO</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> Long_I3 0 Addr 0 p.5</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> Long</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> RTHooks_I3 0 Addr 0 p.6</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> RTHooks</div><div><span class="" style="white-space:pre"> </span>declare_typename<span class="" style="white-space:pre"> </span> 89530742 Uint64</div><div><span class="" style="white-space:pre"> </span>declare_procedure<span class="" style="white-space:pre"> </span> Main__Normalize 2 Void 0 0 F * p.7</div><div><span class="" style="white-space:pre"> </span>declare_local<span class="" style="white-space:pre"> </span> significand 8 4 Int.64 89530742 F F 50 v.4</div><div><span class="" style="white-space:pre"> </span>declare_local<span class="" style="white-space:pre"> </span> exponent 4 4 Int.32 425470580 F F 50 v.5</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> sig 8 4 Int.64 89530742 F F 50 v.6</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> exp 4 4 Int.32 425470580 F F 50 v.7</div><div><span class="" style="white-space:pre"> </span># Normalize</div><div><span class="" style="white-space:pre"> </span>-----LINE 11 -----</div><div><span class="" style="white-space:pre"> </span>begin_procedure<span class="" style="white-space:pre"> </span> p.7</div><div><span class="" style="white-space:pre"> </span>-----LINE 12 -----</div><div><span class="" style="white-space:pre"> </span>-----LINE 19 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.6 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>if_ne<span class="" style="white-space:pre"> </span> Int.64 L.1 100</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> RTHooks__ReportFault 2 Void 0 p.8</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> module 4 4 Addr 138420323 F F 50 v.8</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> info 4 4 Int.32 425470580 F F 50 v.9</div><div><span class="" style="white-space:pre"> </span>set_runtime_proc<span class="" style="white-space:pre"> </span> ReportFault p.8</div><div><span class="" style="white-space:pre"> </span>abort<span class="" style="white-space:pre"> </span> 0</div><div>. L.1 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 20 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.6 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>-----LINE 21 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.7 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>-----LINE 26 -----</div><div><span class="" style="white-space:pre"> </span>jump<span class="" style="white-space:pre"> </span> L.2</div><div>. L.3 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 27 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 10</div><div><span class="" style="white-space:pre"> </span>shift_left<span class="" style="white-space:pre"> </span> Int.64</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>-----LINE 29 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 10</div><div><span class="" style="white-space:pre"> </span>subtract<span class="" style="white-space:pre"> </span> Int.32</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>-----LINE 26 -----</div><div>. L.2 F</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 -18014398509481984</div><div><span class="" style="white-space:pre"> </span>and<span class="" style="white-space:pre"> </span> Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>if_eq<span class="" style="white-space:pre"> </span> Int.64 L.3 80</div><div>. L.4 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 36 -----</div><div><span class="" style="white-space:pre"> </span>jump<span class="" style="white-space:pre"> </span> L.5</div><div>. L.6 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 38 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 1</div><div><span class="" style="white-space:pre"> </span>shift_left<span class="" style="white-space:pre"> </span> Int.64</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>-----LINE 40 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 1</div><div><span class="" style="white-space:pre"> </span>subtract<span class="" style="white-space:pre"> </span> Int.32</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>-----LINE 36 -----</div><div>. L.5 F</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 -9223372036854775808</div><div><span class="" style="white-space:pre"> </span>and<span class="" style="white-space:pre"> </span> Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>if_eq<span class="" style="white-space:pre"> </span> Int.64 L.6 80</div><div>. L.7 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 43 -----</div><div><span class="" style="white-space:pre"> </span>exit_proc<span class="" style="white-space:pre"> </span> Void</div><div><span class="" style="white-space:pre"> </span>end_procedure<span class="" style="white-space:pre"> </span> p.7</div><div><span class="" style="white-space:pre"> </span># Main_M3</div><div><span class="" style="white-space:pre"> </span># module main body Main_M3</div><div><span class="" style="white-space:pre"> </span>-----LINE 45 -----</div><div><span class="" style="white-space:pre"> </span>begin_procedure<span class="" style="white-space:pre"> </span> p.1</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.3 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>if_false<span class="" style="white-space:pre"> </span> Int.32 L.8 0</div><div><span class="" style="white-space:pre"> </span>-----LINE 47 -----</div><div><span class="" style="white-space:pre"> </span>start_call_direct<span class="" style="white-space:pre"> </span> p.7 0 Void</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 3</div><div><span class="" style="white-space:pre"> </span>pop_param<span class="" style="white-space:pre"> </span> Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 2</div><div><span class="" style="white-space:pre"> </span>pop_param<span class="" style="white-space:pre"> </span> Int.32</div><div><span class="" style="white-space:pre"> </span>call_direct<span class="" style="white-space:pre"> </span> p.7 Void</div><div>. L.8 F</div><div><span class="" style="white-space:pre"> </span>load_address<span class="" style="white-space:pre"> </span> v.2 0</div><div><span class="" style="white-space:pre"> </span>exit_proc<span class="" style="white-space:pre"> </span> Addr</div><div><span class="" style="white-space:pre"> </span>end_procedure<span class="" style="white-space:pre"> </span> p.1</div><div><span class="" style="white-space:pre"> </span># global constant type descriptor</div><div><span class="" style="white-space:pre"> </span>declare_record<span class="" style="white-space:pre"> </span> -1 448 0</div><div><span class="" style="white-space:pre"> </span># global data type descriptor</div><div><span class="" style="white-space:pre"> </span>declare_record<span class="" style="white-space:pre"> </span> -1 896 0</div><div><span class="" style="white-space:pre"> </span># module global constants</div><div><span class="" style="white-space:pre"> </span>bind_segment<span class="" style="white-space:pre"> </span> v.1 56 4 Struct F T</div><div><span class="" style="white-space:pre"> </span>begin_init<span class="" style="white-space:pre"> </span> v.1</div><div><span class="" style="white-space:pre"> </span># procedure names</div><div><span class="" style="white-space:pre"> </span>init_chars<span class="" style="white-space:pre"> </span> 0 "Main_M3"</div><div><span class="" style="white-space:pre"> </span>init_chars<span class="" style="white-space:pre"> </span> 8 "Normalize"</div><div><span class="" style="white-space:pre"> </span># procedure table</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 20 p.1</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 24 v.1 0</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 28 p.7</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 32 v.1 8</div><div><span class="" style="white-space:pre"> </span># file name</div><div><span class="" style="white-space:pre"> </span>init_chars<span class="" style="white-space:pre"> </span> 40 "../src/Main.m3"</div><div><span class="" style="white-space:pre"> </span>end_init<span class="" style="white-space:pre"> </span> v.1</div><div><span class="" style="white-space:pre"> </span># module global data</div><div><span class="" style="white-space:pre"> </span>bind_segment<span class="" style="white-space:pre"> </span> v.2 112 4 Struct F T</div><div><span class="" style="white-space:pre"> </span>begin_init<span class="" style="white-space:pre"> </span> v.2</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 0 v.1 40</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 20 v.1 20</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 36 v.2 52</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 44 p.1</div><div><span class="" style="white-space:pre"> </span>init_int<span class="" style="white-space:pre"> </span> 48 3 Int.32</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 56 p.2</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 60 v.2 64</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 68 p.3</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 72 v.2 76</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 80 p.4</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 84 v.2 88</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 92 p.5</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 96 v.2 100</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 104 p.6</div><div><span class="" style="white-space:pre"> </span>end_init<span class="" style="white-space:pre"> </span> v.2</div><div><span class="" style="white-space:pre"> </span># load map</div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># global data allocation for M_Main</div><div><span class="" style="white-space:pre"> </span># 0 52 4 *module info*</div><div><span class="" style="white-space:pre"> </span># 52 12 4 import Main</div><div><span class="" style="white-space:pre"> </span># 64 12 4 import Fmt</div><div><span class="" style="white-space:pre"> </span># 76 12 4 import IO</div><div><span class="" style="white-space:pre"> </span># 88 12 4 import Long</div><div><span class="" style="white-space:pre"> </span># 100 12 4 import RTHooks</div><div><span class="" style="white-space:pre"> </span># 112 0 4 *TOTAL*</div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># global constants for M_Main</div><div><span class="" style="white-space:pre"> </span># 0 18 4 *proc names*</div><div><span class="" style="white-space:pre"> </span># 20 20 4 *proc info*</div><div><span class="" style="white-space:pre"> </span># 40 15 1 *string*</div><div><span class="" style="white-space:pre"> </span># 56 0 4 *TOTAL*</div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span>end_unit<span class="" style="white-space:pre"> </span></div></div><div><br></div><div><br></div><div>Now the intermediate from the latest compiler </div><div><br></div><div><div><span class="" style="white-space:pre"> </span>begin_unit<span class="" style="white-space:pre"> </span> 0</div><div><span class="" style="white-space:pre"> </span>widechar_size<span class="" style="white-space:pre"> </span> 16</div><div><span class="" style="white-space:pre"> </span>-----FILE ../src/Main.m3 -----</div><div><span class="" style="white-space:pre"> </span>-----LINE 1 -----</div><div><span class="" style="white-space:pre"> </span># module global constants</div><div><span class="" style="white-space:pre"> </span>declare_segment<span class="" style="white-space:pre"> </span> * -1 T v.1</div><div><span class="" style="white-space:pre"> </span># module global data</div><div><span class="" style="white-space:pre"> </span>declare_segment<span class="" style="white-space:pre"> </span> M_Main -1 F v.2</div><div><span class="" style="white-space:pre"> </span>-----LINE 45 -----</div><div><span class="" style="white-space:pre"> </span>declare_procedure<span class="" style="white-space:pre"> </span> Main_M3 1 Addr 0 0 T * p.1</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> mode 4 4 Int.32 425470580 F F 100 v.3</div><div><span class="" style="white-space:pre"> </span>declare_proctype<span class="" style="white-space:pre"> </span> 1318003907 2 0 0 0</div><div><span class="" style="white-space:pre"> </span>declare_formal<span class="" style="white-space:pre"> </span> sig 89530742</div><div><span class="" style="white-space:pre"> </span>declare_formal<span class="" style="white-space:pre"> </span> exp 425470580</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> Main_I3 0 Addr 0 p.2</div><div><span class="" style="white-space:pre"> </span>export_unit<span class="" style="white-space:pre"> </span> Main</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> Fmt_I3 0 Addr 0 p.3</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> Fmt</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> IO_I3 0 Addr 0 p.4</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> IO</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> Long_I3 0 Addr 0 p.5</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> Long</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> RTHooks_I3 0 Addr 0 p.6</div><div><span class="" style="white-space:pre"> </span>import_unit<span class="" style="white-space:pre"> </span> RTHooks</div><div><span class="" style="white-space:pre"> </span>declare_typename<span class="" style="white-space:pre"> </span> 89530742 Uint64</div><div><span class="" style="white-space:pre"> </span>declare_procedure<span class="" style="white-space:pre"> </span> Main__Normalize 2 Void 0 0 F * p.7</div><div><span class="" style="white-space:pre"> </span>declare_local<span class="" style="white-space:pre"> </span> significand 8 8 Int.64 89530742 F F 50 v.4</div><div><span class="" style="white-space:pre"> </span>declare_local<span class="" style="white-space:pre"> </span> exponent 4 4 Int.32 425470580 F F 50 v.5</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> sig 8 8 Int.64 89530742 F F 50 v.6</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> exp 4 4 Int.32 425470580 F F 50 v.7</div><div><span class="" style="white-space:pre"> </span># Normalize</div><div><span class="" style="white-space:pre"> </span>-----LINE 11 -----</div><div><span class="" style="white-space:pre"> </span>begin_procedure<span class="" style="white-space:pre"> </span> p.7</div><div><span class="" style="white-space:pre"> </span>-----LINE 12 -----</div><div><span class="" style="white-space:pre"> </span>-----LINE 19 -----</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.6 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>if_ne<span class="" style="white-space:pre"> </span> Int.64 L.1 100</div><div><span class="" style="white-space:pre"> </span>declare_proctype<span class="" style="white-space:pre"> </span> -1531209598 2 0 -1 0</div><div><span class="" style="white-space:pre"> </span>declare_formal<span class="" style="white-space:pre"> </span> module 138420323</div><div><span class="" style="white-space:pre"> </span>declare_formal<span class="" style="white-space:pre"> </span> info 425470580</div><div><span class="" style="white-space:pre"> </span>import_procedure<span class="" style="white-space:pre"> </span> RTHooks__ReportFault 2 Void 0 p.8</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> module 4 4 Addr 138420323 F F 50 v.8</div><div><span class="" style="white-space:pre"> </span>declare_param<span class="" style="white-space:pre"> </span> info 4 4 Int.32 425470580 F F 50 v.9</div><div><span class="" style="white-space:pre"> </span>set_runtime_proc<span class="" style="white-space:pre"> </span> ReportFault p.8</div><div><span class="" style="white-space:pre"> </span>abort<span class="" style="white-space:pre"> </span> 0</div><div>. L.1 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 20 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.6 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>-----LINE 21 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.7 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>-----LINE 26 -----</div><div><span class="" style="white-space:pre"> </span>jump<span class="" style="white-space:pre"> </span> L.2</div><div>. L.3 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 27 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 10</div><div><span class="" style="white-space:pre"> </span>shift_left<span class="" style="white-space:pre"> </span> Word.64</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>-----LINE 29 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 10</div><div><span class="" style="white-space:pre"> </span>subtract<span class="" style="white-space:pre"> </span> Int.32</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>-----LINE 26 -----</div><div>. L.2 F</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 -18014398509481984</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>and<span class="" style="white-space:pre"> </span> Word.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>if_eq<span class="" style="white-space:pre"> </span> Int.64 L.3 80</div><div>. L.4 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 36 -----</div><div><span class="" style="white-space:pre"> </span>jump<span class="" style="white-space:pre"> </span> L.5</div><div>. L.6 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 38 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 1</div><div><span class="" style="white-space:pre"> </span>shift_left<span class="" style="white-space:pre"> </span> Word.64</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>-----LINE 40 -----</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 1</div><div><span class="" style="white-space:pre"> </span>subtract<span class="" style="white-space:pre"> </span> Int.32</div><div><span class="" style="white-space:pre"> </span>store<span class="" style="white-space:pre"> </span> v.5 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>-----LINE 36 -----</div><div>. L.5 F</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.4 0 Int.64 Int.64</div><div><span class="" style="white-space:pre"> </span>and<span class="" style="white-space:pre"> </span> Word.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 0</div><div><span class="" style="white-space:pre"> </span>if_eq<span class="" style="white-space:pre"> </span> Int.64 L.6 80</div><div>. L.7 F</div><div><span class="" style="white-space:pre"> </span>-----LINE 43 -----</div><div><span class="" style="white-space:pre"> </span>exit_proc<span class="" style="white-space:pre"> </span> Void</div><div><span class="" style="white-space:pre"> </span>end_procedure<span class="" style="white-space:pre"> </span> p.7</div><div><span class="" style="white-space:pre"> </span># Main_M3</div><div><span class="" style="white-space:pre"> </span># module main body Main_M3</div><div><span class="" style="white-space:pre"> </span>-----LINE 45 -----</div><div><span class="" style="white-space:pre"> </span>begin_procedure<span class="" style="white-space:pre"> </span> p.1</div><div><span class="" style="white-space:pre"> </span>load<span class="" style="white-space:pre"> </span> v.3 0 Int.32 Int.32</div><div><span class="" style="white-space:pre"> </span>if_false<span class="" style="white-space:pre"> </span> Int.32 L.8 0</div><div><span class="" style="white-space:pre"> </span>-----LINE 47 -----</div><div><span class="" style="white-space:pre"> </span>start_call_direct<span class="" style="white-space:pre"> </span> p.7 0 Void</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.64 3</div><div><span class="" style="white-space:pre"> </span>pop_param<span class="" style="white-space:pre"> </span> Int.64</div><div><span class="" style="white-space:pre"> </span>load_integer<span class="" style="white-space:pre"> </span> Int.32 2</div><div><span class="" style="white-space:pre"> </span>pop_param<span class="" style="white-space:pre"> </span> Int.32</div><div><span class="" style="white-space:pre"> </span>call_direct<span class="" style="white-space:pre"> </span> p.7 Void</div><div>. L.8 F</div><div><span class="" style="white-space:pre"> </span>load_address<span class="" style="white-space:pre"> </span> v.2 0</div><div><span class="" style="white-space:pre"> </span>exit_proc<span class="" style="white-space:pre"> </span> Addr</div><div><span class="" style="white-space:pre"> </span>end_procedure<span class="" style="white-space:pre"> </span> p.1</div><div><span class="" style="white-space:pre"> </span># global constant type descriptor</div><div><span class="" style="white-space:pre"> </span>declare_record<span class="" style="white-space:pre"> </span> -1 448 0</div><div><span class="" style="white-space:pre"> </span># global data type descriptor</div><div><span class="" style="white-space:pre"> </span>declare_record<span class="" style="white-space:pre"> </span> -1 896 0</div><div><span class="" style="white-space:pre"> </span># module global constants</div><div><span class="" style="white-space:pre"> </span>bind_segment<span class="" style="white-space:pre"> </span> v.1 56 8 Struct F T</div><div><span class="" style="white-space:pre"> </span>begin_init<span class="" style="white-space:pre"> </span> v.1</div><div><span class="" style="white-space:pre"> </span># procedure names</div><div><span class="" style="white-space:pre"> </span>init_chars<span class="" style="white-space:pre"> </span> 0 "Main_M3"</div><div><span class="" style="white-space:pre"> </span>init_chars<span class="" style="white-space:pre"> </span> 8 "Normalize"</div><div><span class="" style="white-space:pre"> </span># procedure table</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 20 p.1</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 24 v.1 0</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 28 p.7</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 32 v.1 8</div><div><span class="" style="white-space:pre"> </span># file name</div><div><span class="" style="white-space:pre"> </span>init_chars<span class="" style="white-space:pre"> </span> 40 "../src/Main.m3"</div><div><span class="" style="white-space:pre"> </span>end_init<span class="" style="white-space:pre"> </span> v.1</div><div><span class="" style="white-space:pre"> </span># module global data</div><div><span class="" style="white-space:pre"> </span>bind_segment<span class="" style="white-space:pre"> </span> v.2 112 8 Struct F T</div><div><span class="" style="white-space:pre"> </span>begin_init<span class="" style="white-space:pre"> </span> v.2</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 0 v.1 40</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 20 v.1 20</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 36 v.2 52</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 44 p.1</div><div><span class="" style="white-space:pre"> </span>init_int<span class="" style="white-space:pre"> </span> 48 3 Int.32</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 56 p.2</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 60 v.2 64</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 68 p.3</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 72 v.2 76</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 80 p.4</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 84 v.2 88</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 92 p.5</div><div><span class="" style="white-space:pre"> </span>init_var<span class="" style="white-space:pre"> </span> 96 v.2 100</div><div><span class="" style="white-space:pre"> </span>init_proc<span class="" style="white-space:pre"> </span> 104 p.6</div><div><span class="" style="white-space:pre"> </span>end_init<span class="" style="white-space:pre"> </span> v.2</div><div><span class="" style="white-space:pre"> </span># load map</div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># global data allocation for M_Main</div><div><span class="" style="white-space:pre"> </span># 0 52 4 *module info*</div><div><span class="" style="white-space:pre"> </span># 52 12 4 import Main</div><div><span class="" style="white-space:pre"> </span># 64 12 4 import Fmt</div><div><span class="" style="white-space:pre"> </span># 76 12 4 import IO</div><div><span class="" style="white-space:pre"> </span># 88 12 4 import Long</div><div><span class="" style="white-space:pre"> </span># 100 12 4 import RTHooks</div><div><span class="" style="white-space:pre"> </span># 112 0 4 *TOTAL*</div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span># global constants for M_Main</div><div><span class="" style="white-space:pre"> </span># 0 18 4 *proc names*</div><div><span class="" style="white-space:pre"> </span># 20 20 4 *proc info*</div><div><span class="" style="white-space:pre"> </span># 40 15 1 *string*</div><div><span class="" style="white-space:pre"> </span># 56 0 4 *TOTAL*</div><div><span class="" style="white-space:pre"> </span># </div><div><span class="" style="white-space:pre"> </span>end_unit<span class="" style="white-space:pre"> </span></div></div><div><br></div><div><br></div><div>Its very similar except for using Word.64 instead of Int.64 and a couple of other cosmetic issues.</div><div>The trouble is near label L5 where it does a load_integer of 0 instead of the big constant.</div><div>The result of anding the zero and testing for zero is causing the loop.</div><div>Compiling this with -O also causes the backend to crash.</div><div>Both of these are on LINUXLIBC6. The AMD64 intermediate is correct. Seems like its not parsing the</div><div>big long for some reason or else its wrapping around. </div><div><br></div><div>Any ideas?</div><div><br></div><div>Regards Peter</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 24, 2016 at 4:40 AM, Rodney M. Bates <span dir="ltr"><<a href="mailto:rodney_bates@lcwb.coop" target="_blank">rodney_bates@lcwb.coop</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
<br>
I did git pull and rebuilt on LINUXLIBC6. The built cm3 executable crashes compiling<br>
a very small experiment program:<br>
<br>
rodney@yellowstone:~/proj/m3/exp/FmtBug/src$ cm3-<br>
Segmentation fault (core dumped)<br>
<br>
m3gdb (after I built it) gives this:<br>
<br>
rodney@yellowstone:~/proj/m3/exp/FmtBug/src$ m3gdb cm3-<br>
GNU gdb plus Modula-3 6.4<br>
Copyright 2005 Free Software Foundation, Inc.<br>
GDB is free software, covered by the GNU General Public License, and you are<br>
welcome to change it and/or distribute copies of it under certain conditions.<br>
Type "show copying" to see the conditions.<br>
There is absolutely no warranty for GDB. Type "show warranty" for details.<br>
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".<br>
<br>
(m3gdb) run<br>
Starting program: /usr/local/cm3-githead/bin/cm3-<br>
[Thread debugging using libthread_db enabled]<br>
[New LWP 23615]<br>
[New Thread -1216829744 (LWP 23615)]<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
[Switching to Thread -1216829744 (LWP 23615)]<br>
0x0037c26f in siglongjmp () from /lib/tls/i686/cmov/libc.so.6<br>
(m3gdb) bt<br>
#0 0x0037c26f in siglongjmp () from /lib/tls/i686/cmov/libc.so.6<br>
#1 0x577b2a84 in ?? ()<br>
Cannot access memory at address 0xd7a0906f<br>
(m3gdb) quit<br>
<br>
<br>
stock gdb gives even less information:<br>
<br>
rodney@yellowstone:~/proj/m3/exp/FmtBug/src$ gdb cm3-<br>
GNU gdb (GDB) 7.1-ubuntu<br>
Copyright (C) 2010 Free Software Foundation, Inc.<br>
License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html" rel="noreferrer" target="_blank">http://gnu.org/licenses/gpl.html</a>><br>
This is free software: you are free to change and redistribute it.<br>
There is NO WARRANTY, to the extent permitted by law. Type "show copying"<br>
and "show warranty" for details.<br>
This GDB was configured as "i486-linux-gnu".<br>
For bug reporting instructions, please see:<br>
<<a href="http://www.gnu.org/software/gdb/bugs/" rel="noreferrer" target="_blank">http://www.gnu.org/software/gdb/bugs/</a>>...<br>
Reading symbols from /usr/local/cm3-githead/bin/cm3-...done.<br>
(gdb) run<br>
Starting program: /usr/local/cm3-githead/bin/cm3-<br>
[Thread debugging using libthread_db enabled]<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x0032e26f in ?? () from /lib/tls/i686/cmov/libc.so.6<br>
(gdb) bt<br>
#0 0x0032e26f in ?? () from /lib/tls/i686/cmov/libc.so.6<br>
#1 0xfb35d04b in ?? ()<br>
Cannot access memory at address 0x7bee2da0<br>
(gdb)<br>
<br>
Note that gdb gives a different address in the same library for the point of fault.<br>
<br>
m3gdb claims it's in siglongjmp. I recall there were some recent changes involving<br>
longjump.<div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
On 05/22/2016 09:28 PM, Peter McKinna wrote:<br>
> I dont know what changed but the backend is crashing on linuxlibc6 when compiled with -O Try compiling m3core.<br>
><br>
> Also some of my low level tests with Long.And and Long.Shift are not working with<br>
> normal compile without the optimisations on that platform. Bit suspicious. I'm still investigating.<br>
><br>
> Anyone got any clues or can replicate?<br>
><br>
> Thanks Peter<br>
><br>
><br>
><br>
><br></div></div>
> _______________________________________________<br>
> M3devel mailing list<br>
> <a href="mailto:M3devel@elegosoft.com" target="_blank">M3devel@elegosoft.com</a><br>
> <a href="https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel" rel="noreferrer" target="_blank">https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel</a><br>
><span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
-- <br>
Rodney Bates<br>
<a href="mailto:rodney.m.bates@acm.org" target="_blank">rodney.m.bates@acm.org</a><br>
_______________________________________________<br>
M3devel mailing list<br>
<a href="mailto:M3devel@elegosoft.com" target="_blank">M3devel@elegosoft.com</a><br>
<a href="https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel" rel="noreferrer" target="_blank">https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel</a><br>
</font></span></blockquote></div><br></div>