Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002000Inform 6Generalpublic2017-03-04 19:502017-03-05 05:45
ReporterDavidG 
Assigned To 
PrioritynormalSeveritymildReproducibilityalways
StatusresolvedResolutionduplicate 
PlatformOSOS Version
Product Version6.32 
Target Version6.32Fixed in Version 
Summary0002000: double free or corruption bug with undeclared variable
DescriptionWhile tinkering with Possessive() in english.h in the Inform6 Library (http://www.intfiction.org/forum/viewtopic.php?f=7&t=21349 [^]), I wound up getting this error when compiling a simple test game:

$ inform +./ wave.inf 
Inform 6.34 for Unix (5th March 2016)
"./English.h", line 643: Error:  No such constant as "obj2"
*** Error in `inform': double free or corruption (!prev): 0x0000000001408d10 ***
Aborted


Here's the modified english.h:

[ Possessive obj caps owned; ! "owned" is a new parameter
    if (obj == player) {
        if (player provides narrative_voice) switch(player.narrative_voice) {
          1:  if (caps) print "M"; else print "m"; print "y"; return;
          
2:  ! Do nothing.
          3:  CDefart(player);
              print "'s"; return;
          default: RunTimeError(16, player.narrative_voice);
        }
        if (caps) print "Y"; else print "y";
        print "our"; return;
    }

! This is the new block of code
    if (owned) {
        CDefart(obj2);
!       CDefart(obj);
        print "'s";
        return;
    }

    if (caps) print "H"; else print "h";
    if (obj has male) { print "is"; return; }
    if (obj has female) { print "er"; return; }
    if (caps) print "I"; else { print "i"; print "ts"; return; }
];


The compiler correctly complained about "obj2" being undeclared, but somehow the precise way I did this caused the compiler to choke. Yes, it would abort anyway, but this is abnormal, right?

Now here's a test game:
Minimal Source Text To Reproduce
Constant Story "ROCKS";
Constant Headline "^An Interactive Bug Reproduction^";
Constant DEBUG;

Include "parser.h";
Include "verblib.h";

Object Start_Room "Somewhere"
  with description "You're not sure where you are.",
  has light;

Class Rock
	with name "rock" "rocks//p",
	short_name "rock",
	plural "rocks";

Rock ->;
Rock ->;
Rock ->;
Rock ->;

[ Initialise;
  location = Start_Room;
  "It is time to do some bugfixing...";
];

Include "grammar.h";
Additional InformationOriginally reported at http://www.intfiction.org/forum/viewtopic.php?f=7&t=21398 [^] due to DNS problems with the inform7.com domain.
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0001934resolvedDavidK "double-free or corruption" error when complaining about an undeclared constant. 

-  Notes
(0004659)
zarf (developer)
2017-03-04 22:14

I've tried to reproduce this, but no luck.

I was testing on Linux (with "#define LINUX" in the header), using your inform6lib master branch with that substitution for Possessive() in English.h, and that test source file. Also tested on MacOS with libgmalloc. The compiler reliably says "No such constant as "obj2"" but I don't see any memory errors.
(0004660)
zarf (developer)
2017-03-04 22:20

Are you using the latest Inform code? This looks a lot like http://inform7.com/mantis/view.php?id=1934 [^] .
(0004661)
DavidG (developer)
2017-03-05 03:47

I'm using https://github.com/DavidKinder/Inform6/tree/5af7cef4fa8c45334ed1ef7f3d808867e69535a2 [^]
which is the one I'm pulling in from https://github.com/DavidGriffith/inform6unix. [^] Would you please clone that and try again? Is this is fixed in the absolute latest code, it would be nice to see what happened and hopefully head off unintended consequences.
(0004662)
DavidG (developer)
2017-03-05 04:21
edited on: 2017-03-05 04:23

I did a bisection of the source and I see that https://github.com/DavidKinder/Inform6/tree/25a93cfd5400600e4b6f1192cf00dfe66b04b521 [^] (Fix for Mantis 0001934: Don't fclose() files more than once) fixes this one (0002000). I think this issue can be closed.

(0004663)
DavidG (developer)
2017-03-05 04:52

Oooo!!! 2000 issues! What a milestone!

- Issue History
Date Modified Username Field Change
2017-03-04 19:50 DavidG New Issue
2017-03-04 22:14 zarf Note Added: 0004659
2017-03-04 22:20 zarf Note Added: 0004660
2017-03-05 03:47 DavidG Note Added: 0004661
2017-03-05 04:21 DavidG Note Added: 0004662
2017-03-05 04:22 DavidG Note Edited: 0004662 View Revisions
2017-03-05 04:22 DavidG Note Edited: 0004662 View Revisions
2017-03-05 04:23 DavidG Note Edited: 0004662 View Revisions
2017-03-05 04:52 DavidG Note Added: 0004663
2017-03-05 05:13 DavidK Relationship added duplicate of 0001934
2017-03-05 05:13 DavidK Status new => resolved
2017-03-05 05:13 DavidK Resolution open => duplicate
2017-03-05 05:13 DavidK Assigned To => DavidK
2017-03-05 05:45 DavidK Assigned To DavidK =>


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker