[M3devel] pre-report

Daniel Alejandro Benavides D. dabenavidesd at yahoo.es
Tue Sep 11 03:14:46 CEST 2012


Hi all:
I'm not talking about packed types but values, they must be the same!
Anyway, if you are talking about types I guess that's bigger question IMHO, so pass on to somebody, anyone?
Thanks in advance

--- El lun, 10/9/12, Antony Hosking <hosking at cs.purdue.edu> escribió:

De: Antony Hosking <hosking at cs.purdue.edu>
Asunto: Re: [M3devel] pre-report
Para: "Daniel Alejandro Benavides D." <dabenavidesd at yahoo.es>
CC: "Dragiša Durić" <dragisha at m3w.org>, "m3devel" <m3devel at elegosoft.com>
Fecha: lunes, 10 de septiembre, 2012 19:11

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.


On Sep 10, 2012, at 5:30 PM, "Daniel Alejandro Benavides D." <dabenavidesd at yahoo.es> wrote:
Hi all:
I have read they are equally treated by the compiler, why do you make that illegal?
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).
Thanks in advance

--- El lun, 10/9/12, Antony Hosking <hosking at cs.purdue.edu> escribió:

De: Antony Hosking <hosking at cs.purdue.edu>
Asunto: Re: [M3devel] pre-report
Para: "Dragiša Durić" <dragisha at m3w.org>
CC: "m3devel" <m3devel at elegosoft.com>
Fecha: lunes, 10 de septiembre, 2012 11:17

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.).

>From the language spec:

Implementations are allowed to forbid VAR or READONLY parameters of packed types.

On Sep 10, 2012, at 12:11 PM, Antony Hosking <hosking at cs.purdue.edu> wrote:

> 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.
> 
> In which case, the fix is the following patch to Formal.m3, disallowing a formal parameter for a 
> 
> ***
 Formal.m3.~1.16.~    Wed Sep  5 11:03:31 2012
> --- Formal.m3    Mon Sep 10 12:07:46 2012
> ***************
> *** 356,361 ****
> --- 356,362 ----
>              ELSIF Type.IsEqual (t, te, NIL) THEN
>                Expr.NeedsAddress (e);
>              ELSIF ArrayType.Split (t, index, elt)
> +               AND ArrayType.Split (te, index, elt)
>                AND Type.IsAssignable (t, te) THEN
>                Expr.NeedsAddress (e);
>              ELSE
> 
> 
> 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).
> 
> On Sep 10, 2012, at 3:41 AM, Dragiša Durić <dragisha at m3w.org> wrote:
> 
>> MODULE TestCase EXPORTS Main;
>> 
>> PROCEDURE Do(VAR b: ARRAY OF CHAR) =
>> BEGIN
>> END Do;
>> 
>> VAR
>> arg: RECORD
>>   a: BITS 1 FOR BOOLEAN; (* case 2 is this, case 1 is: comment a out :) *)
>>   b: BITS 24 FOR ARRAY [0..2] OF CHAR;
>> END;
>> 
>> BEGIN
>> Do(arg.b);
>> END TestCase.
>> 
>> --
>> Divided by a common language
>> 
>> Dragiša Durić
>> dragisha at m3w.org
>>
 
>> 
>> 
>> 
>> On Sep 10, 2012, at 4:03 AM, Antony Hosking wrote:
>> 
>>> What’s the source code?
>>> Testcase please...
>>> 
>>> On Sep 8, 2012, at 3:23 AM, Dragiša Durić <dragisha at m3w.org> wrote:
>>> 
>>>> Just got this, many times in a row :)
>>>> 
>>>> ===
>>>> % cm3
>>>> --- building in ../AMD64_DARWIN ---
>>>> 
>>>> new source -> compiling Descriptors.m3
>>>> 
>>>> 
>>>> ***
>>>> *** runtime error:
>>>> ***    <*ASSERT*> failed.
>>>> ***    file "../src/values/Formal.m3", line 689
>>>> ***
>>>>
 
>>>> zsh: abort      cm3
>>>> 
>>>> 
>>>> % cm3 -?
>>>> Critical Mass Modula-3 version d5.9.0
>>>> last updated: 2010-07-21
>>>> compiled: 2011-03-23 04:04:18
>>>> configuration: /usr/local/cm3/bin/cm3.cfg
>>>> host: AMD64_DARWIN
>>>> target: AMD64_DARWIN
>>>> 
>>>> --
>>>> Divided by a common language
>>>> 
>>>> Dragiša Durić
>>>> dragisha at m3w.org
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120911/041cf2dd/attachment-0002.html>


More information about the M3devel mailing list