<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Not true. There are several mentions that packed types and their base types are not equal. In some circumstances they may be assignable. But in this case (aliasing a packed array using VAR) there is no way to communicate the packed-ness of the actual parameter to the callee.<br>
<br><div><div>On Sep 10, 2012, at 5:30 PM, "Daniel Alejandro Benavides D." <<a href="mailto:dabenavidesd@yahoo.es">dabenavidesd@yahoo.es</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font: inherit;">Hi all:<br>I have read they are equally treated by the compiler, why do you make that illegal?<br>If the compiler hasn't as isn't implemented it is an implementation limitation, but that shouldn't affect other compilers that we might want to be source compatible with (I know of a front end but it's "confidential" that throws Attribute Grammar).<br>Thanks in advance<br><br>--- El <b>lun, 10/9/12, Antony Hosking <i><<a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>></i></b> escribió:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>De: Antony Hosking <<a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>><br>Asunto: Re: [M3devel] pre-report<br>Para: "Dragiša Durić" <<a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a>><br>CC: "m3devel" <<a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a>><br>Fecha: lunes, 10 de septiembre, 2012 11:17<br><br><div class="plainMail">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 ymailto="mailto:hosking@cs.purdue.edu" href="x-msg://8053/mc/compose?to=hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>> wrote:<br><br>> 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>> <br>> In which case, the fix is the following patch to Formal.m3, disallowing a formal parameter for a <br>> <br>> ***
Formal.m3.~1.16.~ Wed Sep 5 11:03:31 2012<br>> --- Formal.m3 Mon Sep 10 12:07:46 2012<br>> ***************<br>> *** 356,361 ****<br>> --- 356,362 ----<br>> ELSIF Type.IsEqual (t, te, NIL) THEN<br>> Expr.NeedsAddress (e);<br>> ELSIF ArrayType.Split (t, index, elt)<br>> + AND ArrayType.Split (te, index, elt)<br>> AND Type.IsAssignable (t, te) THEN<br>> Expr.NeedsAddress (e);<br>> ELSE<br>> <br>> <br>> 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>> <br>> On Sep 10, 2012, at 3:41 AM, Dragiša Durić <<a ymailto="mailto:dragisha@m3w.org" href="x-msg://8053/mc/compose?to=dragisha@m3w.org">dragisha@m3w.org</a>> wrote:<br>> <br>>> MODULE TestCase EXPORTS Main;<br>>> <br>>> PROCEDURE Do(VAR b: ARRAY OF CHAR) =<br>>> BEGIN<br>>> END Do;<br>>> <br>>> VAR<br>>> arg: RECORD<br>>> a: BITS 1 FOR BOOLEAN; (* case 2 is this, case 1 is: comment a out :) *)<br>>> b: BITS 24 FOR ARRAY [0..2] OF CHAR;<br>>> END;<br>>> <br>>> BEGIN<br>>> Do(arg.b);<br>>> END TestCase.<br>>> <br>>> --<br>>> Divided by a common language<br>>> <br>>> Dragiša Durić<br>>> <a ymailto="mailto:dragisha@m3w.org" href="x-msg://8053/mc/compose?to=dragisha@m3w.org">dragisha@m3w.org</a><br>>>
<br>>> <br>>> <br>>> <br>>> On Sep 10, 2012, at 4:03 AM, Antony Hosking wrote:<br>>> <br>>>> What’s the source code?<br>>>> Testcase please...<br>>>> <br>>>> On Sep 8, 2012, at 3:23 AM, Dragiša Durić <<a ymailto="mailto:dragisha@m3w.org" href="x-msg://8053/mc/compose?to=dragisha@m3w.org">dragisha@m3w.org</a>> wrote:<br>>>> <br>>>>> Just got this, many times in a row :)<br>>>>> <br>>>>> ===<br>>>>> % cm3<br>>>>> --- building in ../AMD64_DARWIN ---<br>>>>> <br>>>>> new source -> compiling Descriptors.m3<br>>>>> <br>>>>> <br>>>>> ***<br>>>>> *** runtime error:<br>>>>> *** <*ASSERT*> failed.<br>>>>> *** file "../src/values/Formal.m3", line 689<br>>>>> ***<br>>>>>
<br>>>>> zsh: abort cm3<br>>>>> <br>>>>> <br>>>>> % cm3 -?<br>>>>> Critical Mass Modula-3 version d5.9.0<br>>>>> last updated: 2010-07-21<br>>>>> compiled: 2011-03-23 04:04:18<br>>>>> configuration: /usr/local/cm3/bin/cm3.cfg<br>>>>> host: AMD64_DARWIN<br>>>>> target: AMD64_DARWIN<br>>>>> <br>>>>> --<br>>>>> Divided by a common language<br>>>>> <br>>>>> Dragiša Durić<br>>>>> <a ymailto="mailto:dragisha@m3w.org" href="x-msg://8053/mc/compose?to=dragisha@m3w.org">dragisha@m3w.org</a><br>>>>> <br>>>>> <br>>>>> <br>>>>> <br>>>> <br>>> <br>> <br><br></div></blockquote></td></tr></tbody></table></blockquote></div><br></body></html>