TADS Bug Database

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000118TADS 3Compilerpublic2012-01-04 18:202012-01-06 19:07
Reporterlysseus 
Assigned ToMichael Roberts 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformIntelOSWindowsOS Version7
Summary0000118: DynamFunc Runtime error: index out of range Bug
DescriptionIn further exploring the IF-statement bug, I find that if I define an anonymous function prior to the DynamFunc, I get a "Runtime error: index out of range" error.
Steps To ReproduceToss the following code into workbench and step through. When it hits f(2) the error is thrown:

#include <tads.h>
#include <dynfunc.h>

/*
 * The main entrypoint - the T3 virtual machine calls this function to
 * start the program running. 'args' is a list of strings giving the
 * command-line arguments that the user specified, if any.
 */
main(args)
{
    local str = 'function(val) { if (val > 3) cnt++; }';
    local cnt = 0;
    
    local g = new function(val)
    {
        if (val > 3)
            ++cnt;
    };
    
    g(2);
    g(3);
    g(4);
    g(5);
    
    //local f = new DynamicFunc('function(val) { val > 3 ? ++cnt : nil ; }', nil, frame);
    local frame = t3GetStackTrace(1, T3GetStackDesc).frameDesc_;
    local f = new DynamicFunc(str, nil, frame);
    //local f = new DynamicFunc('function(val) { if (val > 3) {++cnt;} }', nil, frame);
    f(2);
    f(3);
    f(4);
    f(5);
}
Additional InformationWindows 7 being run on Mac OS X Lion through Parallels Desktop.
TagsNo tags attached.
Fixed In Version3.1.1
Attached Files

- Relationships

-  Notes
(0000210)
Michael Roberts (administrator)
2012-01-06 19:07

Fixed for the next update.

(This was a problem in the code generator - it was writing the stack frame index instead of the context object index for a local in a context object, which is triggered when the local is accessed from an anonymous function.)

- Issue History
Date Modified Username Field Change
2012-01-04 18:20 lysseus New Issue
2012-01-06 19:07 Michael Roberts Fixed In Version => 3.1.1
2012-01-06 19:07 Michael Roberts Note Added: 0000210
2012-01-06 19:07 Michael Roberts Assigned To => Michael Roberts
2012-01-06 19:07 Michael Roberts Status new => resolved
2012-01-06 19:07 Michael Roberts Resolution open => fixed


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker