Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C62001

Objectloops handled wrong
Submitted by: Torbjörn Andersson     Appeared in: Compiler 6.20     Fixed in: Compiler 6.21
Problem

Inform 6.20 doesn't compile old-style objectloops correctly in non-strict mode. Consider the following example program:

  Object  A;
  Object  -> B;
  Object  -> C;
  Object  -> D;

  [ Main o;
      objectloop (o in A) {
      }
  ];

Inform 6.20 will compile the following Main() function in non-strict mode:

  Routine r0002, 1 local

         get_child       "(A)" -> sp ~l0001
  l0001: pull            local0
         jz              local0 l0003
  l0002: get_sibling     sp -> local0 ?l0002
  l0003: rtrue

My knowledge of Z-code is rather shaky, but this will cause a stack underflow. Inform 6.15, correctly I think, compiles it to:

  Routine r0002, 1 local

         get_child       "(A)" -> sp ~l0001
  l0001: pull            local0
         jz              local0 l0003
  l0002: get_sibling     local0 -> local0 ?l0002
  l0003: rtrue
Solution

Compile in strict mode.

As an alternative, you could try making the following modification to the Inform source code. It's mostly guesswork, but apart from the strict error checking not much has changed here so I figured it would be enough to make it behave as Inform 6.15 did, and this just might do that. In states.c, at line 1024, you should find this:

  if (runtime_error_checking_switch)
  {   AO2 = check_nonzero_at_runtime(AO, ln2,
 		  OBJECTLOOP2_RTE);

This "if" statement doesn't have an "else" clause, so find the matching } (about 20 lines down) and add one like this:

  } else
 	 AO2 = AO;


Last updated 17 April 2013. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.