TADS Bug Database

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000117TADS 3Compilerpublic2012-01-04 16:042012-01-06 19:04
Assigned ToMichael Roberts 
PlatformIntelOSWindowsOS Version7
Summary0000117: DynamFunc IF-Statement Bug
DescriptionThe following code (from the Tads 3 System Manual "DynamFunc" example, increments 'cut', regardless of whether val is '> 3' or not:

#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.
    local cnt = 0;
    local frame = t3GetStackTrace(1, T3GetStackDesc).frameDesc_;
    local f = new DynamicFunc('function(val) { if (val > 3) ++cnt; }', nil, frame);
Steps To Reproduce1. In Workbench, create a new project with the "plain T3" template.
2. Add source file 'dynfunc.t' after Tads System Library files
3. #include <dynfunc.h> after the #include <tads.h>
4. copy and past the sample code above in the main().
5. set breakpoints at first local and f(2) statements.
6 compile and run, stepping though code and watching local value of 'cut'.
Additional InformationTechnically I'm running Windows 7 through Mac OS Lion Parallels Desktop.
TagsNo tags attached.
Fixed In Version3.1.1
Attached Files

- Relationships

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

Fixed for the next update.

The problem was that the compiler effectively generated the 'true' branch of an 'if' twice, once for the 'true' branch (correctly), and then again for the 'false' branch. The 'else' code, if any, was lost in the process.

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

Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker