Globals array isn't always 240 globals (§6.2)
§6.2
Global variables (variable numbers $10 to $ff) are stored in a table in the Z-machine's dynamic memory, at a byte address given in word 6 of the header. The table consists of 240 2-byte words and the initial values of the global variables are the values initially contained in the table. (It is legal for a program to alter the table's contents directly in play, though not for it to change the table's address.)
In short, there isn't always 240 globals. See discussion here.
Zilf make the globals table as big as the actual used globals. Infocom did the same from 1987-.
List of Infocom games (from The Obsessively Complete Infocom Catalog with an array less than 240 globals.
abyss-r1-s890320.z6
arthur-r40-s890502.z6
arthur-r41-s890504.z6
arthur-r54-s890606.z6
arthur-r63-s890622.z6
arthur-r74-s890714.z6
beyondzork-beta-r1-s870715.z5
beyondzork-r47-s870915.z5
beyondzork-r49-s870917.z5
beyondzork-r51-s870923.z5
beyondzork-r57-s871221.z5
beyondzork-r60-s880610.z5
borderzone-r9-s871008.z5
hitchhiker-invclues-r31-s871119.z5
journey-dev-r142-s890205.z6
journey-dev-r46-s880603.z5
journey-r10-s890313.z6
journey-r11-s890304.z6
journey-r2-s890303.z6
journey-r26-s890316.z6
journey-r3-s890310.z6
journey-r30-s890322.z6
journey-r5-s890310.z6
journey-r51-s890522.z6
journey-r54-s890526.z6
journey-r76-s890615.z6
journey-r77-s890616.z6
journey-r79-s890627.z6
journey-r83-s890706.z6
leathergoddesses-invclues-r4-s880405.z5
minizork-r34-s871124.z3
minizork2-r2-s871123.z3
planetfall-r39-s880501.z3
plunderedhearts-r26-s870730.z3
restaurant-r15-s880512.z5
restaurant-r184-s890412.z6
sherlock-dev-r97-s871026.z5
shogun-r278-s890209.z6
shogun-r278-s890211.z6
shogun-r279-s890217.z6
shogun-r280-s890217.z6
shogun-r281-s890222.z6
shogun-r282-s890224.z6
shogun-r283-s890228.z6
shogun-r284-s890302.z6
shogun-r286-s890306.z6
shogun-r288-s890308.z6
shogun-r289-s890309.z6
shogun-r290-s890311.z6
shogun-r291-s890313.z6
shogun-r292-s890314.z6
shogun-r295-s890321.z6
shogun-r311-s890510.z6
shogun-r320-s890627.z6
shogun-r321-s890629.z6
shogun-r322-s890706.z6
wishbringer-invclues-r23-s880706.z5
zork0-alpha-r96-s880224.z5
zork0-beta-r242-s880830.z6
zork0-demo-r366-s890323.z6
zork0-demo-r393-s890714.z6
zork0-ibm-r392-s890714.z6
zork0-oldparser-r1-s871030.z5
zork0-prealpha-r74-s880114.z5
zork0-r153-s880510.z5
zork0-r242-s880901.z6
zork0-r296-s881019.z6
zork0-r343-s890217.z6
zork0-r366-s890323.z6
zork0-r383-s890602.z6
zork0-r387-s890612.z6
zork0-r393-s890714.z6
zork0-r66-s890111.z6
zork1-german-beta-r3-s880113.z5
zork1-german-r15-s890613.z6
zork1-invclues-r52-s871125.z5
zork1-r119-s880429.z3
Those games still have 240 globals, some of their globals are just used for other purposes. Indeed there's no way for a storyfile to communicate that it has fewer globals. Compiler optimisations don't impact the fact that an interpreter will still use all 240 words from the beginning of the globals table as its globals.
If there is something in the spec to update it's probably section 1.1 which says that dynamic memory must be at least 64 bytes. Actually it has to be at least 64+480 bytes. Possibly more if other things can't overlap with them.
Ok, maybe a bit philosophical, but, for example, in leathergoddesses-invclues-r4-s880405.z5 the header information say that the global table starts at 0x02A6 and the object table starts at 0x03FA. That is only 340 bytes difference, not enough space for 240 globals.
Does that mean that only 170 globals are allocated, or does it mean that the last 70 globals space are repurposed for other use?
I still think that §6.2 need a note on how Infocom sometimes repurposed unused global space.
(I agree that §1.1 should state more bytes as a minimum for the dynamic memory.)
Is it illegal for global variables to overlap the header, i.e. would a 480 byte Z-code file necessarily be illegal?
It means that some of the globals are also part of the object table. As long as the game itself doesn't try to use the overlap for both it should still all work out...
I'd take 1.1.1.1 to mean that the globals can't overlap the header.
It's not a hill I'm willing to die on, but it still think it would be helpful with a note that says that overlap can occur and is known from Infocom own games.