[Static Analysis] infer errors in toolkit/*

RESOLVED FIXED in Firefox 63

Status

()

P3
normal
RESOLVED FIXED
5 months ago
5 months ago

People

(Reporter: rbartlensky, Assigned: rbartlensky)

Tracking

(Blocks: 1 bug)

unspecified
mozilla63
Points:
---

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(2 attachments)

(Assignee)

Description

5 months ago
toolkit/mozapps/update/tests/TestAUSHelper.cpp:125: error: DEAD_STORE
  The value written to &rb (type char*) is never used.
  123.     size_t c = fread(rb, sizeof(char), 50, inFP);
  124.     r -= c;
  125. >   rb += c;
  126.     if (c == 0 && r) {
  127.       free(mbuf);

toolkit/components/telemetry/CombinedStacks.cpp:171: error: DEAD_STORE
  The value written to &index (type unsigned int) is never used.
  169.       // Module breakpad identifier
  170.       JS::Rooted<JSString*> id(cx, JS_NewStringCopyZ(cx, module.mBreakpadId.c_str()));
  171. >     if (!id || !JS_DefineElement(cx, moduleInfoArray, index++, id, JSPROP_ENUMERATE)) {
  172.         return nullptr;
  173.       }

toolkit/mozapps/update/updater/updater.cpp:511: error: DEAD_STORE
  The value written to &c (type char*) is never used.
  509.     c += lenQuote;
  510.     *c = NS_T('\0');
  511. >   c++;
  512.     return s;
  513.   }

toolkit/xre/nsAppRunner.cpp:4282: error: DEAD_STORE
  The value written to &rv (type int) is never used.
  4280.     // Re-register components to catch potential changes.
  4281.     nsCOMPtr<nsIFile> flagFile;
  4282. >   rv = NS_ERROR_FILE_NOT_FOUND;
  4283.     if (mAppData->directory) {
  4284.       rv = mAppData->directory->Clone(getter_AddRefs(flagFile));

toolkit/xre/nsAppRunner.cpp:4284: error: DEAD_STORE
  The value written to &rv (type int) is never used.
  4282.     rv = NS_ERROR_FILE_NOT_FOUND;
  4283.     if (mAppData->directory) {
  4284. >     rv = mAppData->directory->Clone(getter_AddRefs(flagFile));
  4285.     }
  4286.     if (flagFile) {

toolkit/xre/nsAppRunner.cpp:4388: error: DEAD_STORE
  The value written to &rv (type int) is never used.
  4386.   XREMain::XRE_mainRun()
  4387.   {
  4388. >   nsresult rv = NS_OK;
  4389.     NS_ASSERTION(mScopedXPCOM, "Scoped xpcom not initialized.");
  4390.

toolkit/xre/nsAppRunner.cpp:4790: error: DEAD_STORE
  The value written to &rv (type int) is never used.
  4788.     AUTO_PROFILER_LABEL("XREMain::XRE_main", OTHER);
  4789.
  4790. >   nsresult rv = NS_OK;
  4791.
  4792.     gArgc = argc;

toolkit/xre/nsAppRunner.cpp:5006: error: DEAD_STORE
  The value written to &rv (type int) is never used.
  5004.   XRE_InitCommandLine(int aArgc, char* aArgv[])
  5005.   {
  5006. >   nsresult rv = NS_OK;
  5007.
  5008.   #if defined(OS_WIN)
Comment hidden (mozreview-request)

Comment 2

5 months ago
mozreview-review
Comment on attachment 8992688 [details]
Bug 1476314: Fix errors reported by infer in toolkit/*.

https://reviewboard.mozilla.org/r/257550/#review264678
Attachment #8992688 - Flags: review?(ehsan) → review+
(Assignee)

Updated

5 months ago
Keywords: checkin-needed

Comment 3

5 months ago
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/47b3297877fa
Fix errors reported by infer in toolkit/*. r=Ehsan
Keywords: checkin-needed
Backed out changeset 47b3297877fa (bug 1476314) for bustage at z:/build/build/src/config/rules.mk [nsAppRunner.obj] on a CLOSED TREE

Backout link: https://hg.mozilla.org/integration/autoland/rev/c7a754017e70c0cddce73fcfbc4c3ba0f1aed97b

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=47b3297877fa9a63d33443f70fbb518659a8ced0

Log link: https://treeherder.mozilla.org/logviewer.html#?job_id=188953855&repo=autoland&lineNumber=1081

Log snippet: 

14:08:32     INFO -  z:/build/build/src/toolkit/xre/nsAppRunner.cpp(5071,10):  error: use of undeclared identifier 'rv'
14:08:32     INFO -    return rv;
14:08:32     INFO -           ^
14:08:32     INFO -  3 warnings and 8 errors generated.
14:08:32     INFO -  z:/build/build/src/config/rules.mk:1052: recipe for target 'nsAppRunner.obj' failed
14:08:32     INFO -  mozmake.EXE[4]: *** [nsAppRunner.obj] Error 1
14:08:32     INFO -  mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/toolkit/xre'
14:08:32     INFO -  mozmake.EXE[4]: *** Waiting for unfinished jobs....
14:08:32     INFO -  mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/gfx/ots/src'
14:08:32     INFO -  z:/build/build/src/sccache2/sccache.exe z:/build/build/src/clang/bin/clang-cl.exe -fms-compatibility-version=19.13.26128 -m32 -FoUnified_cpp_gfx_ots_src2.obj -c -Iz:/build/build/src/obj-firefox/dist/stl_wrappers -DNDEBUG=1 -DTRIMMED=1 '-DPACKAGE_VERSION="moz"' '-DPACKAGE_BUGREPORT="http://bugzilla.mozilla.org/"' -DOTS_GRAPHITE=1 -DOTS_VARIATIONS=1 -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -Iz:/build/build/src/gfx/ots/src -Iz:/build/build/src/obj-firefox/gfx/ots/src -Iz:/build/build/src/modules/woff2/src -Iz:/build/build/src/obj-firefox/dist/include -Iz:/build/build/src/obj-firefox/dist/include/nspr -Iz:/build/build/src/obj-firefox/dist/include/nss -MD -FI z:/build/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT -Qunused-arguments -Qunused-arguments -TP -nologo -w15038 -wd5026 -wd5027 -Zc:sizedDealloc- -wd4091 -wd4577 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -arch:SSE2 -Gw -wd4251 -wd4244 -wd4267 -wd4800 -wd4595 -wd4065 -Wno-inline-new-delete -Wno-invalid-offsetof -Wno-microsoft-enum-value -Wno-microsoft-include -Wno-unknown-pragmas -Wno-ignored-pragmas -Wno-deprecated-declarations -Wno-invalid-noreturn -Wno-inconsistent-missing-override -Wno-implicit-exception-spec-mismatch -Wno-unused-local-typedef -Wno-ignored-attributes -Wno-used-but-marked-unused -we4553 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR- -Z7 -O2 -Oy-  -Xclang -MP -Xclang -dependency-file -Xclang .deps/Unified_cpp_gfx_ots_src2.obj.pp -Xclang -MT -Xclang Unified_cpp_gfx_ots_src2.obj    z:/build/build/src/obj-firefox/gfx/ots/src/Unified_cpp_gfx_ots_src2.cpp
14:08:32     INFO -  In file included from z:/build/build/src/obj-firefox/gfx/ots/src/Unified_cpp_gfx_ots_src2.cpp:56:
14:08:32     INFO -  z:/build/build/src/gfx/ots/src/variations.cc(150,18):  warning: unused variable 'INNER_INDEX_BIT_COUNT_MASK' [-Wunused-variable]
14:08:32     INFO -    const uint16_t INNER_INDEX_BIT_COUNT_MASK = 0x000F;
14:08:32     INFO -                   ^
14:08:32     INFO -  In file included from z:/build/build/src/obj-firefox/gfx/ots/src/Unified_cpp_gfx_ots_src2.cpp:2:
14:08:32     INFO -  In file included from z:/build/build/src/gfx/ots/src/post.cc:5:
14:08:32     INFO -  In file included from z:/build/build/src/gfx/ots/src/post.h:8:
14:08:32     INFO -  In file included from z:/build/build/src/gfx/ots/src/ots.h:19:
14:08:32     INFO -  In file included from z:/build/build/src/obj-firefox/dist/stl_wrappers\map:57:
14:08:32     INFO -  In file included from z:\build\build\src\vs2017_15.6.6\VC\include\map:8:
14:08:32     INFO -  In file included from z:\build\build\src\vs2017_15.6.6\VC\include\xtree:6:
14:08:32     INFO -  In file included from z:\build\build\src\vs2017_15.6.6\VC\include\xmemory:6:
14:08:32     INFO -  z:\build\build\src\vs2017_15.6.6\VC\include\xmemory0(925,3):  warning: destructor called on non-final 'ots::OpenTypeSILF::SILSub' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
14:08:32     INFO -                  _Ptr->~_Uty();
Flags: needinfo?(rbartlensky)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Comment 7

5 months ago
Created attachment 8993663 [details]
Bug 1476314: Fix errors reported by infer in toolkit/*.
Comment hidden (mozreview-request)
(Assignee)

Comment 9

5 months ago
(In reply to Raul Gurzau (:RaulGurzau) from comment #4)
> Backed out changeset 47b3297877fa (bug 1476314) for bustage at
> z:/build/build/src/config/rules.mk [nsAppRunner.obj] on a CLOSED TREE
> 
> Backout link:
> https://hg.mozilla.org/integration/autoland/rev/
> c7a754017e70c0cddce73fcfbc4c3ba0f1aed97b
> 
> Push with failures:
> https://treeherder.mozilla.org/#/
> jobs?repo=autoland&revision=47b3297877fa9a63d33443f70fbb518659a8ced0
> 
> Log link:
> https://treeherder.mozilla.org/logviewer.
> html#?job_id=188953855&repo=autoland&lineNumber=1081
> 
> Log snippet: 
> 
> 14:08:32     INFO - 
> z:/build/build/src/toolkit/xre/nsAppRunner.cpp(5071,10):  error: use of
> undeclared identifier 'rv'
> 14:08:32     INFO -    return rv;
> 14:08:32     INFO -           ^
> 14:08:32     INFO -  3 warnings and 8 errors generated.
> 14:08:32     INFO -  z:/build/build/src/config/rules.mk:1052: recipe for
> target 'nsAppRunner.obj' failed
> 14:08:32     INFO -  mozmake.EXE[4]: *** [nsAppRunner.obj] Error 1
> 14:08:32     INFO -  mozmake.EXE[4]: Leaving directory
> 'z:/build/build/src/obj-firefox/toolkit/xre'
> 14:08:32     INFO -  mozmake.EXE[4]: *** Waiting for unfinished jobs....
> 14:08:32     INFO -  mozmake.EXE[4]: Entering directory
> 'z:/build/build/src/obj-firefox/gfx/ots/src'
> 14:08:32     INFO -  z:/build/build/src/sccache2/sccache.exe
> z:/build/build/src/clang/bin/clang-cl.exe
> -fms-compatibility-version=19.13.26128 -m32 -FoUnified_cpp_gfx_ots_src2.obj
> -c -Iz:/build/build/src/obj-firefox/dist/stl_wrappers -DNDEBUG=1 -DTRIMMED=1
> '-DPACKAGE_VERSION="moz"'
> '-DPACKAGE_BUGREPORT="http://bugzilla.mozilla.org/"' -DOTS_GRAPHITE=1
> -DOTS_VARIATIONS=1 -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE
> -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -Iz:/build/build/src/gfx/ots/src
> -Iz:/build/build/src/obj-firefox/gfx/ots/src
> -Iz:/build/build/src/modules/woff2/src
> -Iz:/build/build/src/obj-firefox/dist/include
> -Iz:/build/build/src/obj-firefox/dist/include/nspr
> -Iz:/build/build/src/obj-firefox/dist/include/nss -MD -FI
> z:/build/build/src/obj-firefox/mozilla-config.h -DMOZILLA_CLIENT
> -Qunused-arguments -Qunused-arguments -TP -nologo -w15038 -wd5026 -wd5027
> -Zc:sizedDealloc- -wd4091 -wd4577 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline
> -arch:SSE2 -Gw -wd4251 -wd4244 -wd4267 -wd4800 -wd4595 -wd4065
> -Wno-inline-new-delete -Wno-invalid-offsetof -Wno-microsoft-enum-value
> -Wno-microsoft-include -Wno-unknown-pragmas -Wno-ignored-pragmas
> -Wno-deprecated-declarations -Wno-invalid-noreturn
> -Wno-inconsistent-missing-override -Wno-implicit-exception-spec-mismatch
> -Wno-unused-local-typedef -Wno-ignored-attributes
> -Wno-used-but-marked-unused -we4553
> -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR- -Z7 -O2 -Oy-  -Xclang -MP
> -Xclang -dependency-file -Xclang .deps/Unified_cpp_gfx_ots_src2.obj.pp
> -Xclang -MT -Xclang Unified_cpp_gfx_ots_src2.obj   
> z:/build/build/src/obj-firefox/gfx/ots/src/Unified_cpp_gfx_ots_src2.cpp
> 14:08:32     INFO -  In file included from
> z:/build/build/src/obj-firefox/gfx/ots/src/Unified_cpp_gfx_ots_src2.cpp:56:
> 14:08:32     INFO -  z:/build/build/src/gfx/ots/src/variations.cc(150,18): 
> warning: unused variable 'INNER_INDEX_BIT_COUNT_MASK' [-Wunused-variable]
> 14:08:32     INFO -    const uint16_t INNER_INDEX_BIT_COUNT_MASK = 0x000F;
> 14:08:32     INFO -                   ^
> 14:08:32     INFO -  In file included from
> z:/build/build/src/obj-firefox/gfx/ots/src/Unified_cpp_gfx_ots_src2.cpp:2:
> 14:08:32     INFO -  In file included from
> z:/build/build/src/gfx/ots/src/post.cc:5:
> 14:08:32     INFO -  In file included from
> z:/build/build/src/gfx/ots/src/post.h:8:
> 14:08:32     INFO -  In file included from
> z:/build/build/src/gfx/ots/src/ots.h:19:
> 14:08:32     INFO -  In file included from
> z:/build/build/src/obj-firefox/dist/stl_wrappers\map:57:
> 14:08:32     INFO -  In file included from
> z:\build\build\src\vs2017_15.6.6\VC\include\map:8:
> 14:08:32     INFO -  In file included from
> z:\build\build\src\vs2017_15.6.6\VC\include\xtree:6:
> 14:08:32     INFO -  In file included from
> z:\build\build\src\vs2017_15.6.6\VC\include\xmemory:6:
> 14:08:32     INFO - 
> z:\build\build\src\vs2017_15.6.6\VC\include\xmemory0(925,3):  warning:
> destructor called on non-final 'ots::OpenTypeSILF::SILSub' that has virtual
> functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
> 14:08:32     INFO -                  _Ptr->~_Uty();

Fixed, waiting for approval.
Flags: needinfo?(rbartlensky)
(Assignee)

Comment 10

5 months ago
I made a small update to make it compile on windows as well, could you have a look?
Flags: needinfo?(ehsan)
Comment on attachment 8993663 [details]
Bug 1476314: Fix errors reported by infer in toolkit/*.

:Ehsan Akhgari has approved the revision.

https://phabricator.services.mozilla.com/D2266
Attachment #8993663 - Flags: review+

Comment 12

5 months ago
r+ed the phabricator patch.

Updated

5 months ago
Flags: needinfo?(ehsan)
(Assignee)

Updated

5 months ago
Keywords: checkin-needed

Comment 13

5 months ago
Pushed by rvandermeulen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/291c6c44928d
Fix errors reported by infer in toolkit/*. r=Ehsan
Keywords: checkin-needed

Comment 14

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/291c6c44928d
Status: NEW → RESOLVED
Last Resolved: 5 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.