X-Git-Url: https://jxself.org/git/?p=inform.git;a=blobdiff_plain;f=src%2Fexpressc.c;fp=src%2Fexpressc.c;h=067cab395b286e68363e2c3bbeac13459c2a9e9f;hp=f8c75530f67eb365f497e48a8980407c1c9e8b8c;hb=ee3b3a0cb830792c0569230872a0af20eab8bb7b;hpb=8e63120c630c94c598d4e2d6ba823dac59bce8fa diff --git a/src/expressc.c b/src/expressc.c index f8c7553..067cab3 100644 --- a/src/expressc.c +++ b/src/expressc.c @@ -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++;