Update to Inform v6.41
[inform.git] / src / expressc.c
index f8c75530f67eb365f497e48a8980407c1c9e8b8c..067cab395b286e68363e2c3bbeac13459c2a9e9f 100644 (file)
@@ -1,7 +1,7 @@
 /* ------------------------------------------------------------------------- */
 /*   "expressc" :  The expression code generator                             */
 /*                                                                           */
-/*   Part of Inform 6.40                                                     */
+/*   Part of Inform 6.41                                                     */
 /*   copyright (c) Graham Nelson 1993 - 2022                                 */
 /*                                                                           */
 /* Inform is free software: you can redistribute it and/or modify            */
@@ -448,7 +448,7 @@ static void access_memory_z(int oc, assembly_operand AO1, assembly_operand AO2,
 
     assembly_operand zero_ao, max_ao, size_ao, en_ao, type_ao, an_ao,
         index_ao;
-    int x = 0, y = 0, byte_flag = FALSE, read_flag = FALSE, from_module = FALSE;
+    int x = 0, y = 0, byte_flag = FALSE, read_flag = FALSE;
 
     INITAO(&zero_ao);
     INITAO(&size_ao);
@@ -476,10 +476,12 @@ static void access_memory_z(int oc, assembly_operand AO1, assembly_operand AO2,
             error("Cannot write to a static array");
         }
 
-        if (size_ao.value==-1) 
-            from_module=TRUE;
+        if (size_ao.value==-1) {
+            /* This case was originally meant for module linking.
+               It should no longer be possible. */
+            compiler_error("Array size cannot be negative");
+        }
         else {
-            from_module=FALSE;
             type_ao = zero_ao; type_ao.value = arrays[y].type;
 
             if ((!is_systemfile()))
@@ -511,7 +513,7 @@ static void access_memory_z(int oc, assembly_operand AO1, assembly_operand AO2,
     /* If we recognise AO1 as arising textually from a declared
        array, we can check bounds explicitly. */
 
-    if ((AO1.marker == ARRAY_MV || AO1.marker == STATIC_ARRAY_MV) && (!from_module))
+    if ((AO1.marker == ARRAY_MV || AO1.marker == STATIC_ARRAY_MV))
     {   
         int passed_label = next_label++, failed_label = next_label++,
             final_label = next_label++;