ARM js shell fails to compile due to warnings

RESOLVED FIXED

Status

()

Core
JavaScript Engine
--
blocker
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: gkw, Unassigned)

Tracking

Trunk
ARM
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(2 attachments)

(Reporter)

Description

7 years ago
Created attachment 520892 [details]
log

Since changeset cdcef9d0f76a where bug 609532 turned warnings fatal, the ARM js shell has been failing to compile.
(Reporter)

Comment 1

7 years ago
Although I'm not sure, I think the opt shell warning might be fixed by first initializing it:

size_t preBytes = 0;
preBytes = cx->runtime->gcBytes;

instead of:

size_t preBytes = cx->runtime->gcBytes;
Blocks: 609532

Comment 2

7 years ago
Why wasn't this picked up by tinderbox? Can we fix that problem too?
> Debug shell:
> 
> jstracer.cpp
> Assembler.cpp
> cc1plus: warnings being treated as errors
> nanojit/Assembler.cpp: In member function ‘nanojit::Register nanojit::Assembler::findRegFor(nanojit::LIns*, nanojit::RegisterMask)’:
> nanojit/Assembler.cpp:548: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:548: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:548: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp: In member function ‘void nanojit::Assembler::endAssembly(nanojit::Fragment*)’:
> nanojit/Assembler.cpp:1136: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp: In member function ‘void nanojit::Assembler::gen(nanojit::LirFilter*)’:
> nanojit/Assembler.cpp:1854: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:1859: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:1878: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:1881: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:1886: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
> nanojit/Assembler.cpp:1912: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’

These line numbers don't match up to any code that could cause that error,
AFAICT.  Gary, can you rerun and see if some code has changed?

> shell/js.cpp: In function ‘JSBool GC(JSContext*, uintN, jsval*)’:
> shell/js.cpp:1413: error: unused variable ‘preBytes’

That's just wrong.  The function looks like this:

    static JSBool
    GC(JSContext *cx, uintN argc, jsval *vp)
    {
        size_t preBytes = cx->runtime->gcBytes;
        JS_GC(cx);

        char buf[256];
        JS_snprintf(buf, sizeof(buf), "before %lu, after %lu, break %08lx\n",
                    (unsigned long)preBytes, (unsigned long)cx->runtime->gcBytes,
    #ifdef HAVE_SBRK
                    (unsigned long)sbrk(0)
    #else
                    0
    #endif  
                    );
        *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));
        return true;
    }

preBytes is clearly used!  Compiler bug, maybe?  How annoying.  Maybe it's confused by the cast?  Gary, can you try changing it to this?

  unsigned long preBytes = (unsigned long) cx->runtime->gcBytes;

and remove the cast from the JS_snprintf?  (I'm just grasping at straws here.)
(Reporter)

Comment 4

7 years ago
(In reply to comment #3)
> These line numbers don't match up to any code that could cause that error,
> AFAICT.  Gary, can you rerun and see if some code has changed?

I still see this:

Allocator.cpp
CodeAlloc.cpp
cc1plus: warnings being treated as errors
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp: In member function ‘nanojit::Register nanojit::Assembler::findRegFor(nanojit::LIns*, nanojit::RegisterMask)’:
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:542: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:542: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:542: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp: In member function ‘void nanojit::Assembler::endAssembly(nanojit::Fragment*)’:
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1130: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp: In member function ‘void nanojit::Assembler::gen(nanojit::LirFilter*)’:
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1848: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1853: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1872: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1875: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1880: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp:1906: error: format ‘%p’ expects type ‘void*’, but argument 3 has type ‘nanojit::NIns*’

In the directory  /home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/dbg-objdir
The following command failed to execute properly:
/usr/bin/ccache c++ -o Assembler.o -c -fvisibility=hidden -DOSTYPE="Linux2.6.32" -DOSARCH=Linux -DEXPORT_JS_API -D__STDC_LIMIT_MACROS -I/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath -I. -I./dist/include -I./dist/include/nsprpub -I/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath -I/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/assembler -I/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/yarr -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fno-strict-aliasing -pthread -march=armv7-a -marm -mfloat-abi=softfp -pipe -DDEBUG -D_DEBUG -DTRACING -g -Werror -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1 -DMOZILLA_CLIENT -include ./js-confdefs.h -MD -MF .deps/Assembler.pp /home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/nanojit/Assembler.cpp
make[1]: *** [Assembler.o] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1plus: warnings being treated as errors
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/jstracer.cpp: In function ‘bool js::ExecuteTree(JSContext*, js::TraceMonitor*, js::TreeFragment*, uintN&, js::VMSideExit**, js::VMSideExit**)’:
/home/ubuntu/Desktop/jsfunfuzz-dbg-32-tm-63382-1b80976e274b/compilePath/jstracer.cpp:6591: error: format ‘%p’ expects type ‘void*’, but argument 7 has type ‘nanojit::NIns*’

This line 6591 of jstracer.cpp:

debug_only_printf(LC_TMTracer, "entering trace at %s:%u@%u, execs: %u code: %p\n",
                  cx->fp()->script()->filename,
                  js_FramePCToLineNumber(cx, cx->fp()),
                  FramePCOffset(cx, cx->fp()),
       f->execs,
       f->code());

seems to indicate that f->code() is being printf'ed in a wrong format.
(Reporter)

Comment 5

7 years ago
Somehow the preBytes error disappeared, so that part WFM.
Created attachment 522258 [details] [diff] [review]
patch

Gary, can you try this patch?  There may still be other warnings, though.  If they are all just cases where a (void*) cast is required for a %p build, it might be easier if you fix them all and then put up a patch that I can review.  How's that sound?
(Reporter)

Comment 7

7 years ago
(In reply to comment #6)
> Created attachment 522258 [details] [diff] [review]
> patch
> 
> Gary, can you try this patch?  There may still be other warnings, though.  If
> they are all just cases where a (void*) cast is required for a %p build, it
> might be easier if you fix them all and then put up a patch that I can review. 
> How's that sound?

Nick, this patch fixes all the compile issues for ARM on tip. :)
Comment on attachment 522258 [details] [diff] [review]
patch

Trivial review for Gal, in his capacity as a strong proponent of warnings-as-errors.
Attachment #522258 - Flags: review?(gal)

Updated

7 years ago
Attachment #522258 - Flags: review?(gal) → review+
(Reporter)

Comment 9

7 years ago
http://hg.mozilla.org/tracemonkey/rev/a8c3626e7987
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/a8c3626e7987
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.