[M3devel] release engineering 5.8: trac issue 1005 (open array initializers)

Tony Hosking hosking at cs.purdue.edu
Fri Apr 16 16:45:41 CEST 2010


Here's the testcase:

MODULE Main;
IMPORT IO;

<*UNUSED*> VAR a : ARRAY [0..0] OF CHAR := ARRAY OF CHAR {'a'};
<*UNUSED*> VAR b : ARRAY [0..0] OF CHAR := ARRAY OF CHAR {'b'};
<*UNUSED*> VAR c : ARRAY [0..0] OF CHAR := ARRAY OF CHAR {'c'};
<*UNUSED*> VAR d : ARRAY [0..0] OF CHAR := ARRAY OF CHAR {'d'};

BEGIN
  IO.Put("OK\n");
END Main.

I looked into this a while back and have some understanding of what is going on.  Still no fix yet.

Note that this is weird code that does have a more concise workaround, which is probably why we don't see it often:

MODULE Main;
IMPORT IO;

<*UNUSED*> VAR a := ARRAY [0,0] OF CHAR {'a'};
<*UNUSED*> VAR b := ARRAY [0,0] OF CHAR {'b'};
<*UNUSED*> VAR c := ARRAY [0,0] OF CHAR {'c'};
<*UNUSED*> VAR d := ARRAY [0,0] OF CHAR {'d'};

BEGIN
  IO.Put("OK\n");
END Main.

The problem arises because in the first form the compiler tries to initialise a literal array constant for each of the array constructor expressions before assigning them to the variables.  In the second form it initialises the variables directly from the elements of the constructor.

Need to dig deeper.


Antony Hosking | Associate Professor | Computer Science | Purdue University
305 N. University Street | West Lafayette | IN 47907 | USA
Office +1 765 494 6001 | Mobile +1 765 427 5484




On 16 Apr 2010, at 05:38, Olaf Wagner wrote:

> I'm currently reviewing the open issues again, and came across
> 
>  https://projects.elego.de/cm3/ticket/1005
> 
> Not sure if I've asked before, but do we need to solve this for this
> release? The GC error seems strange:
> 
> --- ../src/p2/p209/stderr.build 2009-06-29 21:47:53.000000000 +0200
> +++ ../src/p2/p209/AMD64_LINUX/stderr.build 2009-07-20 08:17:17.000000000 +0200
> @@ -0,0 +1,13 @@
> +o is 0x348
> +init_pc is 0x0
> +bias is 0x5c8
> +Target.Address.align is 0x40
> +Target.Byte is 0x8
> +
> +
> +***
> +*** runtime error:
> +*** <*ASSERT*> failed.
> +*** file "../src/misc/CG.m3", line 1077
> +***
> +
> 
> Olaf
> -- 
> Olaf Wagner -- elego Software Solutions GmbH
>               Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
> phone: +49 30 23 45 86 96  mobile: +49 177 2345 869  fax: +49 30 23 45 86 95
>   http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
> Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100416/66a2a11a/attachment-0002.html>


More information about the M3devel mailing list