MMIX Bug Report IS |
||
Content
|
MMIXware Versionmmix-20110831Bug ReportedInitial: 25/1/2012AuthorMartin RuckertDescriptionmmixal can give misleading error messages for the IS instruction.DetailsThe following MMIX programLOC #4000000 Main JMP there there IS here JMP further further IS near near IS Mainproduces the following error messages: "bug.mms", line 4: the operand is undefined! "bug.mms", line 7: relative address in location #0000000004000004 is too far away! (2 errors were found.)Both error messages are caused by IS instructions. mmixal will create a new symbol with value zero and status undefined in section <Scan the operand field>. For the first instruction, the correct error message is produced by mixal in section <Do a one-operand operation>. For the second IS instruction, mmixal will use the undefined operand value in section <Define the label> to set cur_loc, which is then used in section <Fix prior references to this label>. There, the difference between the address of the JMP instruction (#4000004) and the (undefined) value zero of the symbol "near" is considered too big to fit into the 24-bit relative address field of the JMP instruction. Consequently, the second, at least misleading, error message is produced. Proposed PatchSince an undefined operand is not allowed for an IS instruction (not even if it is a forward reference), apply the following change to mmixal (section <Define the label>):@x if (opcode==IS) { cur_loc=val_stack[0].equiv; @y if (opcode==IS) { if (val_stack[0].status==undefined) err("the operand is undefined"); cur_loc=val_stack[0].equiv; @zAfter printing the error message, the "err" macro includes a "goto bypass" which will skip the remainder of <Define the label> and the complete section <Do the operation>. The new error messages are: "bug.mms", line 4: the operand is undefined! "bug.mms", line 7: the operand is undefined! undefined symbol: further undefined symbol: there DiscussionThe patch as given above is now part of the sources. |
Please help to keep this site up to date! If you want to point out important material or projects that are not listed here, if you find errors or want to suggest improvements, please send email to