diff --git a/mozilla/js/ref/jsinterp.c b/mozilla/js/ref/jsinterp.c index 0bc14265b9d..b77db742adb 100644 --- a/mozilla/js/ref/jsinterp.c +++ b/mozilla/js/ref/jsinterp.c @@ -1118,7 +1118,7 @@ js_Interpret(JSContext *cx, jsval *result) #if JS_HAS_SWITCH_STATEMENT case JSOP_DEFAULT: - POP(); + (void) POP(); /* fall through */ #endif case JSOP_GOTO: @@ -1661,7 +1661,7 @@ js_Interpret(JSContext *cx, jsval *result) #if JS_HAS_SWITCH_STATEMENT case JSOP_CASE: NEW_EQUALITY_OP(==, JS_FALSE); - POP(); + (void) POP(); if (cond) { len = GET_JUMP_OFFSET(pc); CHECK_BRANCH(len); @@ -1848,7 +1848,16 @@ js_Interpret(JSContext *cx, jsval *result) case JSOP_NEG: POP_NUMBER(cx, d); +#ifdef HPUX + /* + * Negation of a zero doesn't produce a negative + * zero on HPUX. Perform the operation by bit + * twiddling. + */ + JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT; +#else d = -d; +#endif PUSH_NUMBER(cx, d); break; diff --git a/mozilla/js/ref/jsnum.c b/mozilla/js/ref/jsnum.c index 41b70262a17..45249ebca59 100644 --- a/mozilla/js/ref/jsnum.c +++ b/mozilla/js/ref/jsnum.c @@ -653,6 +653,16 @@ js_strtod(JSContext *cx, const jschar *s, const jschar **ep, jsdouble *dp) d = *cx->runtime->jsPositiveInfinity; else if (d == -HUGE_VAL) d = *cx->runtime->jsNegativeInfinity; +#ifdef HPUX + if (d == 0.0 && negative) { + /* + * "-0", "-1e-2000" come out as positive zero + * here on HPUX. Force a negative zero instead. + */ + JSDOUBLE_HI32(d) = JSDOUBLE_HI32_SIGNBIT; + JSDOUBLE_LO32(d) = 0; + } +#endif } free(cstr); diff --git a/mozilla/js/ref/jsparse.c b/mozilla/js/ref/jsparse.c index 456bf57ee9a..fb639500ab4 100644 --- a/mozilla/js/ref/jsparse.c +++ b/mozilla/js/ref/jsparse.c @@ -2704,7 +2704,16 @@ js_FoldConstants(JSContext *cx, JSParseNode *pn) break; case JSOP_NEG: - d = -d; +#ifdef HPUX + /* + * Negation of a zero doesn't produce a negative + * zero on HPUX. Perform the operation by bit + * twiddling. + */ + JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT; +#else + d = -d; +#endif break; case JSOP_POS: