[M3devel] pre-report
Dragiša Durić
dragisha at m3w.org
Tue Sep 11 08:07:35 CEST 2012
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.
Thank you for the fix!
--
Divided by a common language
Dragiša Durić
dragisha at m3w.org
On Sep 10, 2012, at 6:17 PM, Antony Hosking wrote:
> 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/5b12d215/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120911/5b12d215/attachment-0002.sig>
More information about the M3devel
mailing list