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
Assigned To 
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 ( [^]), 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 ***

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(obj);
        print "'s";

    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 [^] due to DNS problems with the domain.
TagsNo tags attached.
Attached Files

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

-  Notes
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.
zarf (developer)
2017-03-04 22:20

Are you using the latest Inform code? This looks a lot like [^] .
DavidG (developer)
2017-03-05 03:47

I'm using [^]
which is the one I'm pulling in from [^] 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.
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 [^] (Fix for Mantis 0001934: Don't fclose() files more than once) fixes this one (0002000). I think this issue can be closed.

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