JS Correctness: Different output with options "-m -n" vs. "-m -n -a"

RESOLVED FIXED in mozilla11

Status

()

Core
JavaScript Engine
--
critical
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: decoder, Assigned: bhackett)

Tracking

(Blocks: 1 bug, {regression, testcase})

Trunk
mozilla11
x86_64
Linux
regression, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
The following test produces different output with options "-m -n" vs. "-m -n -a" on mozilla-central revision e320f9f5536f:


function reportFailure (msg) {
  var lines = msg.split ("\n");
  var funcName = currentFunc();
  var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
  for (var i=0; i<lines.length; i++)
    print (" FAILED! " + prefix + lines[i]);
}
function reportCompare (expected, actual, description) {
  var output = "";
  if (expected != actual)
      reportFailure (description + " : " + output);
}
function currentFunc() {}
var summary = (2);
var expect = '';
function test() {
  var prototype;
  function Bug() {
    prototype;
  }
  actual = (new Bug instanceof Bug);
  reportCompare(expect, actual, summary);
}
test();
test();


The number of outputted lines differs depending on the options (where $JS is just the javascript shell binary):

$ $JS -m -n min.js
 FAILED! 2 : 
 FAILED! 2 : 
$ $JS -m -n -a min.js
 FAILED! 2 :
(Assignee)

Comment 1

6 years ago
Created attachment 577665 [details] [diff] [review]
patch

Bill, I remember you reporting this a while ago but can't find the bug.  Construction of 'this' can't be inlined for non-singletons because the resolve hook of the callee may get skipped (which constructs the default prototype objects for functions).
Assignee: general → bhackett1024
Attachment #577665 - Flags: review?(wmccloskey)
Comment on attachment 577665 [details] [diff] [review]
patch

Cool, thanks. It was bug 698101. Could you make sure the patch works on that test case?

Also, we're now trying to put the brace on a separate line for multi-line conditionals like this one. It creates a clearer separation between the condition and the code.
Attachment #577665 - Flags: review?(wmccloskey) → review+
(Assignee)

Updated

6 years ago
Duplicate of this bug: 698101
(Assignee)

Comment 4

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/0dd55a7547cd
https://hg.mozilla.org/mozilla-central/rev/0dd55a7547cd
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.