<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have no problem with compiler forbidding it, it is logical. And much better than compiler crash, or internal CG error :). And my example caught both.<div><br></div><div>Thank you for the fix!</div><div><br><div><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Divided by a common language</div><div><br></div><div>Dragiša Durić</div><div><a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Sep 10, 2012, at 6:17 PM, Antony Hosking wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I’ve gone ahead and committed the "fix" to prohibit treating BITS FOR ARRAY OF X as assignable to VAR formals that are ARRAY OF X. There is no way to communicate the alignment of any BITS FOR ARRAY in its containing structure (RECORD, etc.).<br><br>From the language spec:<br><br>Implementations are allowed to forbid VAR or READONLY parameters of packed types.<br><br>On Sep 10, 2012, at 12:11 PM, Antony Hosking <<a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>> wrote:<br><br><blockquote type="cite">I’m trying to get a sense for what the correct behavior of the compiler should be in this case. I think that the passing of the unaligned ARRAY OF CHAR as an open array parameter should be disallowed. There is no way to communicate the alignment in the dope vector built for the open array formal.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">In which case, the fix is the following patch to Formal.m3, disallowing a formal parameter for a <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">*** Formal.m3.~1.16.~<span class="Apple-tab-span" style="white-space:pre"> </span>Wed Sep 5 11:03:31 2012<br></blockquote><blockquote type="cite">--- Formal.m3<span class="Apple-tab-span" style="white-space:pre"> </span>Mon Sep 10 12:07:46 2012<br></blockquote><blockquote type="cite">***************<br></blockquote><blockquote type="cite">*** 356,361 ****<br></blockquote><blockquote type="cite">--- 356,362 ----<br></blockquote><blockquote type="cite"> ELSIF Type.IsEqual (t, te, NIL) THEN<br></blockquote><blockquote type="cite"> Expr.NeedsAddress (e);<br></blockquote><blockquote type="cite"> ELSIF ArrayType.Split (t, index, elt)<br></blockquote><blockquote type="cite">+ AND ArrayType.Split (te, index, elt)<br></blockquote><blockquote type="cite"> AND Type.IsAssignable (t, te) THEN<br></blockquote><blockquote type="cite"> Expr.NeedsAddress (e);<br></blockquote><blockquote type="cite"> ELSE<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Can anyone think if this will break any existing code? I can’t think of anything where it will break (assigning something that does not have array type to a formal parameter of array type).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Sep 10, 2012, at 3:41 AM, Dragiša Durić <<a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a>> wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">MODULE TestCase EXPORTS Main;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PROCEDURE Do(VAR b: ARRAY OF CHAR) =<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">BEGIN<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">END Do;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">VAR<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">arg: RECORD<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> a: BITS 1 FOR BOOLEAN; (* case 2 is this, case 1 is: comment a out :) *)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> b: BITS 24 FOR ARRAY [0..2] OF CHAR;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">END;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">BEGIN<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Do(arg.b);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">END TestCase.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Divided by a common language<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Dragiša Durić<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">On Sep 10, 2012, at 4:03 AM, Antony Hosking wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">What’s the source code?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Testcase please...<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On Sep 8, 2012, at 3:23 AM, Dragiša Durić <<a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a>> wrote:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Just got this, many times in a row :)<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">===<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">% cm3<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">--- building in ../AMD64_DARWIN ---<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">new source -> compiling Descriptors.m3<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">***<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">*** runtime error:<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">*** <*ASSERT*> failed.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">*** file "../src/values/Formal.m3", line 689<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">***<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">zsh: abort cm3<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">% cm3 -?<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Critical Mass Modula-3 version d5.9.0<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">last updated: 2010-07-21<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">compiled: 2011-03-23 04:04:18<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">configuration: /usr/local/cm3/bin/cm3.cfg<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">host: AMD64_DARWIN<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">target: AMD64_DARWIN<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Divided by a common language<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Dragiša Durić<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><br></div></blockquote></div><br></div></div></body></html>