Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001688Inform 6Generalpublic2015-06-28 08:002016-10-01 10:52
Reporterdfremont 
Assigned ToDavidK 
PrioritylowSeverityseriousReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86OSMac OS XOS Version10.10
Product Version 
Target VersionFixed in Version 
Summary0001688: Compiler error on returning empty parentheses
DescriptionIn a function, the statement "return ();" causes this compiler error: "SR error: emitter stack empty". An example and the resulting output are below.
Minimal Source Text To Reproduce
Foo is a room.
Include (-
[ blob ;
	return ();
];
-).
Additional InformationThe relevant output, as reported from the Inform IDE:

/Applications/Inform.app/Contents/Resources/Compilers/inform6 \
-kE2SDwG +include_path=/Applications/Inform.app/Contents/Resources/Library/6.11,.,../Source /Users/dfremont/Documents/Inform/Projects/test2.inform/Build/auto.inf /Users/dfremont/Documents/Inform/Projects/test2.inform/Build/output.ulx
Launching: inform6 "-kE2SDwG" "+include_path=/Applications/Inform.app/Contents/Resources/Library/6.11,.,../Source" "/Users/dfremont/Documents/Inform/Projects/test2.inform/Build/auto.inf" "/Users/dfremont/Documents/Inform/Projects/test2.inform/Build/output.ulx"
Inform 6.33N for Mac OS X (20th August 2014)
File "/Users/dfremont/Documents/Inform/Projects/test2.inform/Build/auto.inf"; Line 36664 # *** Compiler error: SR error: emitter stack empty
File "/Users/dfremont/Documents/Inform/Projects/test2.inform/Build/auto.inf"; Line 36664 # Error: Expected ';' but found ]
> ]
In: 1 source code files 65873 syntactic lines
 54885 textual lines 1982321 characters (ISO 8859-1 Latin1)
Allocated:
  8013 symbols (maximum 20000) 18132952 bytes of memory
Out: Glulx story file 1.150628 (582K long):
    21 classes (maximum 200) 42 objects (maximum 512)
   230 global vars (maximum 512) 85003 variable/array space (maximum 180000)
    96 verbs (maximum 255) 316 dictionary entries (maximum 1300)
   179 grammar lines (version 2) 251 grammar tokens (unlimited)
   101 actions (maximum 200) 37 attributes (maximum 56)
    40 common props (maximum 256) 18 individual props (unlimited)
108205 characters used in text 84874 bytes compressed (rate 0.784)
     0 abbreviations (maximum 64) 2869 routines (unlimited)
 68995 instructions of code 38973 sequence points
105216 bytes writable memory used 490496 bytes read-only memory used
595712 bytes used in machine 1073146112 bytes free in machine
Compiled with 1 error and 1642 suppressed warnings (no output)
***********************************************************************
* 'Compiler errors' should never occur if Inform is working properly. *
* This is version 6.33 of Inform, dated 20th August 2014: so *
* if that was more than six months ago, there may be a more recent *
* version available, from which the problem may have been removed. *
* If not, please report this fault to: graham@gnelson.demon.co.uk *
* and if at all possible, please include your source code, as faults *
* such as these are rare and often difficult to reproduce. Sorry. *
***********************************************************************
Completed in 0 seconds

Compiler finished with code 1
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0003936)
zarf (developer)
2015-06-28 10:00

Confirmed.

Does *not* happen with a line like "x = ();" -- that produces the error "No expression between brackets '(' and ')'", which is presumably what we want.
(0003937)
zarf (developer)
2015-06-28 10:01

(Reducing severity, as this is "invalid code produces compiler error")
(0003953)
dfremont (reporter)
2015-06-29 10:59

This happens for print statements as well as returns. Also, with two sets of parentheses, e.g. "return () ();", you get slightly different errors:

*** Compiler error: SR error: Attempt to add a marker to the top of an empty emitter stack
*** Compiler error: Z-code OT in Glulx assembly operand.
(0004523)
zarf (developer)
2016-08-07 15:07

Patch: https://github.com/erkyrath/inform6/commit/d99609c09b2beda79e0a3682c6341941e13cd105 [^]

This only affects the error case, so it should not make any difference for valid code. (I did some tests to make sure.)

The error on "return ()()" is more serious -- the compiler seems to get into an infinite loop after the "Attempt to add a marker" error, and it runs out of MAX_EXPRESSION_NODES. (This will be even more serious in some future time when we remove compiler memory limits!) I'm not sure what to do about this, however. Maybe mark_top_of_emitter_stack() should return an error flag that causes parse_expression() to exit.

- Issue History
Date Modified Username Field Change
2015-06-28 08:00 dfremont New Issue
2015-06-28 10:00 zarf Note Added: 0003936
2015-06-28 10:00 zarf Assigned To => zarf
2015-06-28 10:00 zarf Status new => confirmed
2015-06-28 10:01 zarf Note Added: 0003937
2015-06-28 10:01 zarf Severity critical => serious
2015-06-29 10:59 dfremont Note Added: 0003953
2015-06-29 11:41 zarf Priority normal => low
2016-08-07 15:07 zarf Note Added: 0004523
2016-08-07 15:07 zarf Assigned To zarf => DavidK
2016-08-07 15:07 zarf Status confirmed => assigned
2016-10-01 10:52 DavidK Status assigned => resolved
2016-10-01 10:52 DavidK Resolution open => fixed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker